See jobs in the log? It's not an array, how to push it as an array (so I can access it via loop).
https://jsfiddle.net/1jo43e8c/1/
var name = "John"
var age = 30
var jobs = ['a', 'b', 'c']
obj = []
obj.push('{name: "'+name+'", age: "'+age+'", jobs: '+jobs+'}')
console.log(obj) // result: ["{name: "John", age: "30", jobs: a,b,c}"]
/////////////////// goal: ["{name: "John", age: "30", jobs: ["a","b","c"]}"]
JSON.stringify()instead of your custom serialization might help.JSON.stringify()?obj.push(JSON.stringify({name, age, jobs}))should do what you needjobs: '+jobs+'this callstoString()method on array. As @VladimirBogomolov mentioned you don't need string concatenation to create an object