Answers for "how to use variable in js key"

0

how to use variable in js key

ES6 defines ComputedPropertyName
var thetop = "top",
    obj = { [thetop]: 10 };

console.log(obj.top); // -> 10
Posted by: Guest on October-15-2020

Code answers related to "how to use variable in js key"

Code answers related to "Javascript"

Browse Popular Code Answers by Language