Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

dynamic key in javascript object

var key = 'DYNAMIC_KEY',
    obj = {
        [key]: 'ES6!'
    };

console.log(obj);
// > { 'DYNAMIC_KEY': 'ES6!' }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dynamic #key #javascript #object
ADD COMMENT
Topic
Name
3+5 =