Skip to content

Instantly share code, notes, and snippets.

@goodbedford
Last active November 13, 2015 06:40
Show Gist options
  • Save goodbedford/0fc278e5b6275a709181 to your computer and use it in GitHub Desktop.
Save goodbedford/0fc278e5b6275a709181 to your computer and use it in GitHub Desktop.
// you want to get a new puppy so you go to the puppy palace. you need to print out the list of
// all the puppies to make your choice. write a function that will
// do loops in three ways and print puppy name,breed and age to each to console.
// for loop, while loop, forEach
function puppyPrint () {
var puppies = [
{name: "ruff",
breed: "beagle",
age: 1
},
{name: "bunny",
breed: "terrier",
age: 2
},
{name: "solo",
breed: "mix-breed",
age: 3
}
];
console.log("The For Loop");
//your for loop below
//your while loop below
console.log("The While Loop");
//your forEach below
console.log("forEach")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment