I'm making some JS code, where I need to set a variable as a key in a JSON array with Javascript array.push()
:
var test = 'dd'+questNumb;
window.voiceTestJSON.push({test:{"title":""}, "content":{"date":""}});
Where questNumb
is another variable. When doing that code, the part where I just write the test
variable it just becomes to the key "test"
, so I have no idea of getting this to wok. How could it be? Thanks!