Created
April 19, 2018 22:50
-
-
Save akanix42/871e6c96f42de933ed3e74dd9bdfc440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CartStore { | |
constructor() { | |
this.products = []; | |
} | |
add(product) { | |
if (this.products.includes(product)) { | |
return; | |
} | |
this.products.push(product); | |
} | |
clear() { | |
this.products = []; | |
} | |
} | |
const cartStore = new CartStore(); | |
export default cartStore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment