Created
February 28, 2015 17:30
-
-
Save yortuc/44896eac93c1d7046afc 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
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment