this.addToCart = function(id,name,category,price) {
alert(id+"name"+name);
var eachProduct = [
{
"name": name,
"id": id,
"category":category,
"price":price
}
];
alert(eachProduct.name);//I am getting undefine
addedProductsList.push(eachProduct);
sessionStorage.setItem("addedProductsList", addedProductsList);
return "success";
};
How to pass the function parameters to each product?