Created
June 12, 2014 02:40
-
-
Save MilanGrubnic70/d3d7c43d6473d669bbae to your computer and use it in GitHub Desktop.
mac4
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
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