Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 6, 2016 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/0ce0dc25c4b377c7ce6e484715a9dec7 to your computer and use it in GitHub Desktop.
Save codecademydev/0ce0dc25c4b377c7ce6e484715a9dec7 to your computer and use it in GitHub Desktop.
Codecademy export
var friends = {};
friends.bill = {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: ['One Microsoft Way','Redmond','WA','98052']
};
friends.steve = {
firstName: "Steve",
lastName: "Jobs",
number: "(408) 555-5555",
address: ['1 Infinite Loop','Cupertino','CA','95014']
};
var list = function(friends) {
for(var key in friends) {
console.log(key);
}
};
var search = function(name) {
for(var key in friends) {
if(friends[key].firstName === name) {
console.log(friends[key]);
return friends[key];
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment