UNPKG

asd.js

Version:

demo

40 lines (38 loc) 780 B
//asd.js module.exports.shoppingCart = (function(){ var list = []; function add(item){ list.push(item) } function remove(id){ for (var i = 0; i < list.length; i++) { if(list[i].id == id){ list.splice(i, 1); return; } } } function getAll(){ return list; } return{ addToCart : add, deleteFromCart : remove, getCart :getAll } })(); module.exports.developedBy = "Phaniraj"; module.exports.developedOn = new Date(); module.exports.desc = "Developed for the DIOT team of CDAC KP Office as a part of training"; module.exports.math = (function(){ add = function(first, second){ return first + second; } sub = function(first, second){ return first - second; } return{ add : add, sub : sub } })();