push as object, or as separated items

I have very simple question.

But what is the difference between:

export const addToCart = function(product, quantity){
    cart.push({product, quantity});
    console.log(`${quantity} ${product} are added`);
}

and

export const addToCart = function(product, quantity){
    cart.push(product, quantity);
    console.log(`${quantity} ${product} are added`);
}

Thank you

Answer

First is push an object into an array while second is push each item into an array.

var a =[];
a.push({b:1,c:2}) // [{b: 1, c: 2}]
a.push(1,2) // [1,2]