可以使用 Array.prototype.push() 方法将对象的值添加到数组末尾。
例如:
let obj = {name: "John", age: 30};
let arr = [];
arr.push(obj);
console.log(arr);
可以使用 Array.prototype.push() 方法将对象的值添加到数组末尾。
例如:
let obj = {name: "John", age: 30};
let arr = [];
arr.push(obj);
console.log(arr);