Computed property names are supported in ECMAScript2015:
var name = 'key'; var value = 'value'; var o = { [name]: value }; alert("o as json : " + JSON.stringify(o));
548k questions
547k answers
4 comments
86.3k users