Skip to content

Instantly share code, notes, and snippets.

@ultrasamad
ultrasamad / Cart.js
Created August 14, 2017 12:41
A simple shopping cart implementation in javascript based on es6.
class Cart{
constructor(products) {
if (!this.storageSupported()){
throw "Browser doesn't support localStorage"
}
this.products = products;
//this.items = JSON.parse(localStorage.getItem('cart'))
}