Menu
I want to get a string to pass into a function as a variable. For example, I have:
zoo_list = new Array(“giraffe”, “lion”, “tiger”, “hippo”);
hippo = new Array(“Hippogirl”, “Hippee”);
function myAnimal (trait) {
DoWhatever
}
THIS WORKS:
It works if I called the function like so:
myAnimal(Hippogirl);
THIS DOESN’T:
When written like this, it doesn’t work:
for (i=0; i=hippo.length; i++) {
myAnimal(hippo[i]);
}
When looped, “Hippogirl”, etc… aren’t passed in as a variable. I hope someone understands what I’m trying to do.