You can access JavaScript object properties that have hyphens in the name (a.k.a. kebab case) by using the bracket property accessor notation, like so:
const obj = { 'foo-bar': 123 }; console.log(obj['foo-bar']); // 123
It's the same even if the object property name has hyphens at start or the end:
const obj = { '--foo-bar-': 123 }; console.log(obj['--foo-bar-']); // 123
Hope you found this post useful. It was published . Please show your love and support by sharing this post.