Search function didn't log to console


#1

var search=function(lastName){
var contactsLength= contacts.length;
for (var i=0 ; i if(lastName===contacts[i].lastname){
printPerson(contacts[i]);
}
}
}

search("Jones");
whts wrong with this????? im getting an error like
Oops, try again. It looks like your search function didn't log "Bob Jones" to the console. Did you remember to call search after you defined it??


#2

Looks like a paste-in gone wrong. There are two statements overlapping.

for (var i = 0; i < contactsLength; i++) {
    if (lastName === contacts[i].lastName){
        printPerson(contacts[i]);
    }
}