Last active
January 3, 2016 05:59
-
-
Save nola/8419770 to your computer and use it in GitHub Desktop.
Revisions
-
nola revised this gist
Jan 14, 2014 . 1 changed file with 0 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -34,15 +34,5 @@ var search = function(name) { } }; list(friends); search("Steve"); -
nola revised this gist
Jan 14, 2014 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,6 @@ function add(firstName, lastName, phoneNumber, email){ phoneNumber: phoneNumber, email: email } } list(friends); -
nola revised this gist
Jan 14, 2014 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -34,5 +34,16 @@ var search = function(name) { } }; // adding new additions to our objects function add(firstName, lastName, phoneNumber, email){ contacts[contacts.length]={ //interesting, insert at that last point in the array. array starts at zero so length is perfect firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, email: email } } list(friends); search("Steve"); -
nola revised this gist
Jan 14, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var friends = {}; //add people to it friends.bill = { //observe this declaration as bill is an object of friends firstName: "Bill", lastName: "Gates", number: "(206) 555-5555", -
nola created this gist
Jan 14, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ //create an object var friends = {}; //add people to it friends.bill = { //observe this notation firstName: "Bill", lastName: "Gates", number: "(206) 555-5555", address: ['One Microsoft Way','Redmond','WA','98052'] }; //add another friends.steve = { firstName: "Steve", lastName: "Jobs", number: "(408) 555-5555", address: ['1 Infinite Loop','Cupertino','CA','95014'] }; //log out all contents of the object var list = function(obj) { for(var prop in obj) { console.log(prop); } }; //search for "steve" var search = function(name) { for(var prop in friends) { if(friends[prop].firstName === name) { console.log(friends[prop]); return friends[prop]; } } }; list(friends); search("Steve");