📅  最后修改于: 2022-03-11 15:01:48.711000             🧑  作者: Mango
var element = {}, cart = [];
element.id = id;
element.quantity = quantity;
cart.push(element);
// Array of Objects in form {element: {id: 10, quantity: 10} }
var element = {}, cart = [];
element.id = id;
element.quantity = quantity;
cart.push({element: element});