You can use optional chaining (?.) with the bracket notation (object property accessor) by adding the ?. symbol before the bracket notation, like so:

// ES11+
obj?.['prop']

For example:

// ES11+
const obj = { 'foo-bar': 123 };

console.log(obj?.['foo-bar']); // 'bar'
console.log(obj?.['non-existent']); // undefined