Searching Friends List, Cant return contact info for Steve


Question 7 in Contact list ask for an if/else statement. Where would the else go in this code? Im getting an error that says "It looks like your search function doesnt return contact info for Steve"

var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "555-444-4444",
address: ['222 Megan Ct','Newark','DE','19702']
steve: {
firstName: "Steve",
lastName: "Jobs",
number: "555-555-5555",
address: ['17 Forsynthia Lane','Bear','DE','19701']

function list(friends){for(var name in friends){console.log(name);

var search = function(name){
for(var firstName in friends){
if(friends[firstName].firstname === name){
return friends[firstName];



for(var firstName in friends)

why use firstName as iterator? This makes the code really confusing (in my opinion)
then here:

if(friends[firstName].firstname === name){

change [firstName] to whatever you named your iterator, then make sure you spell .firstName with uppercase N

if you really want to use an else make a for/else, so that else runs when the for loop has finished


Changing the capital N did the trick! Syntax o Syntax....