Answers for "javascript dynamic property accessor"

0

javascript dynamic property accessor

var something = {
  bar: 'foo'
};
var foo = 'bar';

// both x = something[foo] and something[foo] = x work as expected
console.log(something[foo]);
console.log(something.bar)
Posted by: Guest on May-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language