internet explorer - JAVASCRIPT : create dynamic key in IE -


this question has answer here:

var jsonuiid = "sdfsdf"; a={         [jsonuiid] : {         "heading":"title"         } }; 

tried directly in developer tools. above code works in browsers. fails in internet explorer. please help.

if don't square bracket[], directly gets "jsonuiid" rather actual value defined above.

computed property names part of es6 not supported browsers. can set object property old-style bracket notation:

var jsonuiid = "sdfsdf"; var = {}; a[jsonuiid] = {     "heading": "title" }; 

Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

file - Python: AttributeError: 'str' object has no attribute 'readlines' -

c# - Get the Class name in a class with atribute inside a attribute method -