JS Agregar datos en el objeto

var element = {}, cart = [];
element.id = id;
element.quantity = quantity;
cart.push(element);
Wandering Walrus