Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var List = function(){
- this.data = [];
- this.add = add;
- this.remove = remove;
- this.count = count;
- }
- function add(item){
- this.data.push(item);
- }
- function remove(item){
- for(var i = 0; i < this.data.length; i++){
- if(this.data[i] === item){
- return this.data.splice(i, 1);
- }
- }
- }
- function count(){
- return this.data.length;
- }
- module.exports = List;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement