Contact list


#1

Editor keep telling me that my search function does not return contact information of steve ..can you help me out ..I cann't understand why..

var friends={};
friends.bill={
firstName:'bill',
lastName:'Jack',
number:5646747,
address:['Bajhajatin','kolkata','india']
};
friends.steve={
firstName:'steve',
lastName:'jobs',
number:564674787,
address:['ohio','usa','world']
};
friends.matt={
firstName:'Matt',
lastName:'Demon',
number:56467478767,
address:['cantaky','usa','world']
};

var list=function(obj){
for (var person in obj) {
console.log(person);
}
};
var search=function(name){
for(var key in friends){
if(friends[key].firstName===name){
console.log(friends[key]);
return friends[key];
}
}
};
list('friends');
search('steve');


#2

@boardslayer42364,

The course-checker is expecting
the firstName properties to be a string Value "Bill" and "Steve"
with a capital-starting-character


#3

Thank you sir..but is it necessery or only for this practice ?


#4

@boardslayer42364,
only for this exercise.....

+++ contact list explained
object description
search as function
for-in loop explained
http://www.codecademy.com/forum_questions/54a616f9937676fb3d0024c7


#5

Thanks..Can you tell me what is the difference in console.log and return statement inside a function or any case ??


#6

@boardslayer42364,

Reference::

google search
=the book=
javascript variable site:developer.mozilla.org
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literals
javascript return statement site:developer.mozilla.org
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return
=discussions=
javascript return statement site:stackoverflow.com
http://stackoverflow.com/questions/3717420/is-there-a-benefit-to-using-a-return-statement-that-returns-nothing
http://stackoverflow.com/questions/22134753/return-statement-in-javascript

google search
== the Book ==
jquery [your question] site:developer.mozilla.org
CSS [your question] site:developer.mozilla.org
javascript [your question] site:developer.mozilla.org
[your question] site:jquery.com
[your question] site:getbootstrap.com

== discussions / opinions ==
jquery [your question] site:stackoverflow.com
CSS [your question] site:stackoverflow.com
javascript [your question] site:stackoverflow.com

== guidance ==
www.crockford.com
[your question] site:crockford.com
- - http://javascript.crockford.com/code.html
- - http://javascript.crockford.com/survey.html