I want to lookup for a key on an object, but if the key does't exist, it must return null, is it possible in JavaScript?
const d = {
A: () => { return 'A' },
B: () => { return 'B' },
C: () => { return 'C' },
}
const key = 'Z'
const func = d[key] // HERE
console.log(func)
undefined, but if you really wantnull..const func = d[key] || null