Skip to content

Instantly share code, notes, and snippets.

@MilanGrubnic70
Created June 12, 2014 02:40
Show Gist options
  • Save MilanGrubnic70/d3d7c43d6473d669bbae to your computer and use it in GitHub Desktop.
Save MilanGrubnic70/d3d7c43d6473d669bbae to your computer and use it in GitHub Desktop.
mac4
function Animal(name, legs){
this.name = name;
this.legs = legs;
};
var Zoo = {
init: function(arg){
var animals = arg;
}, // init
bipeds: function(){
var deuce = [];
for (var i = 0; i < animals.length; i++){
if (animals[i].legs === 2){
deuce.push(animals[i])
}//if
}//for loop
return deuce
},//bipeds
quadrupeds: function(){
var quad = [];
for (var i = 0; i < animals.length; i++){
if (animals[i].legs === 4){
quad.push(animals[i])
}//if
}//for
return quad
}//quad
}; // zoo
Animal.prototype.identify = function(){
return "I am a " + this.name + " with " + this.legs + " legs.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment