MainComponentController
handleClickAddToCartEvent: function(component, event, helper) {
let product = event.getParam("product");
let productCart = component.get("v.productCart");
if (productCart==null){
productCart =new Map();
}
if(productCart.has(product.PricebookEntries[0].Id)){
productCart.set(product.PricebookEntries[0].Id,(productCart.get(productCart)+1));
console.log('productCart.has():'+product.PricebookEntries[0].Id +'|'+ productCart.get(product.PricebookEntries[0].Id));
}
else{
productCart.set(product.PricebookEntries[0].Id,1);
}
component.set("v.productCart",productCart);
},
This page has an error. You might just need to refresh it. Action failed: c:MainComponent$controller$handleClickAddToCartEvent [productCart.has is not a function] Failing descriptor: {c:MainComponent$controller$handleClickAddToCartEvent}