Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param {string} category
- */
- getProductArray(category){
- const index = this.cart.findIndex( (cart) => {
- cart.category === category;
- });
- let productArray;
- if(index >= 0){
- productArray = this.cart[index].products;
- }
- else{
- productArray = {category: category, products: []};
- this.cart.push(productArray);
- }
- return productArray;
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement