02/11/2024
π - Day 2: Tricky Object Property Challenge! π€
Can you solve this brain teaser?
const prop = 'name';
const obj = { [prop]: 'JavaScript' };
If you change const prop = 'name' to const prop = 'language', what would be the value of obj.name?
Which option is correct?
A) 'JavaScript'
π 'name'
C) undefined
D) 'language'
Drop your answer below! π
Challenge yourself to understand computed property names in JavaScript!