Finding that Special Someone Syntax error


#1

var bob = {
firstName: "Bob",
lastName: "Jones",
phoneNumber: "(650) 777-7777",
email: "bob.jones@example.com"
};

var mary = {
firstName: "Mary",
lastName: "Johnson",
phoneNumber: "(650) 888-8888",
email: "mary.johnson@example.com"
};

var contacts = [bob, mary];

function printPerson(person) {
console.log(person.firstName + " " + person.lastName);
}

function list() {
var contactsLength = contacts.length;
for (var i = 0; i < contactsLength; i++) {
printPerson(contacts[i]);
}
}

/*Create a search function
then call it passing "Jones"*/

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

}

}

search("Jones");

For the life of me, I can't figure out where my error is...


#2

wow...really? just found it.... it's where that dumb smiley face is. I added an extra semicolon


#3

i have not laughed since years ... that dumb smiley hahahahah


#4

hahah thats a great way to check syntax.


#5

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

not var search = function(lastName)