Error in syntax?


#1

Hey guys, I'm an experienced Java programmer trying to learn JS, and I bet I just did something with Java Syntax that we can't do in JS. Can anyone spot my error in syntax?

var friends = {
bill: {
firstName:"Bill",
lastName:"Barber",
number:1,
address:['21 Broad Street', 'Philadelpiha', 'PA']
},
steve: {
firstName:"Steve",
lastName:"Nicks",
number:2,
address:['22 Broad Street','Philadelphia', 'PA']
}
};

var list = function(friends){
for(var firstName in friends){
console.log(firstName);
}
};

var search = funtion(name){
for(var key in friends){
if(friends[key].firstname === name){
console.log(friends[key]);
return friends[key];
}
}
};

Thanks in advance!


#2

@biggity,

Have a close look at

friends[key].firstname


#3

That was definitely wrong! Thank you! When I camel case it, I still have the syntax error. Hmm...


#4

@biggity

Have a close look at

funtion


#5

Man . . . . that's embarassing! But I am so relieved! Thank you!!