Skip to content

Instantly share code, notes, and snippets.

@yortuc
Created February 28, 2015 17:30
Show Gist options
  • Save yortuc/44896eac93c1d7046afc to your computer and use it in GitHub Desktop.
Save yortuc/44896eac93c1d7046afc to your computer and use it in GitHub Desktop.
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