Why does it say I have an extra )


#1

var search = function(lastName) {
var contactsLength = contact.length;
for() {
if(lastName = lastName) {
console.log(printPerson);
} else {
console.log();
}
}
};

search("Jones")


#2

var search = function(lastName) {
    var contactsLength = contact.length;
    for() { //You have no condition in your for loop
        if(lastName = lastName) { // and you need a second = sign, because one is simply an assignment
            console.log(printPerson);
        } else {
            console.log();
        }
    }
};

search("Jones")

#3

@brian_marmon, I'd suggest looking back to the earlier lessons, refresh yourself on how a "for" loop works, as well to refresh yourself on how an "if" statement works.

@dantemp, please don't just add code without an explanation, that doesn't help anybody figure out how to do the lesson, it just gives them the answer.


#4

@lolman I do have an explanation, and I didn't post a solution.


#5

@dantemp for pointing out the problem with the for loop. I fixed it with also adding new code and replacing something for it to work.

@lolman it was thanks to him pointing out the problem with the for loop that I didn't notice. Once that happened was able to fix it and rewrite some of that function with one from earlier in the lesson without having to look back