push to array as variable, not string

后端 未结 0 632
灰色年华
灰色年华 2021-01-18 04:25

i am trying to do the following:

var cars = [];
var newCar = "toyota";
cars.push({
newCar: {
year: 2000,
}
})

it saves newCar as &q

相关标签:
回答
  • 消灭零回复
提交回复
热议问题