What could be the problem?


the console says: ReferenceError: Invalid left-hand side expression in postfix operation

and thats the error message: Oops, try again. Did you remember to log the result of your search to the console?

what could be the problem? thanks in advance!

here is my code:

/*jshint multistr:true*/

var text = "blah blah blah blah Lawrence blah blah bah \
blah bah lbah blah blah blah blah blah blah Lawrence \
blah bah blah blah blaha blah";

var myName = "Lawrence";

var hits = [];

for (var i = 0; i < text.length; i++) {
if (text[i] === myName[0]) {
for (var j = i; j < (myName.length + i) ++j; {



if (hits.length === 0) {
console.log ("Your name wasn't found!");
else {
console.log (hits);


Hi try to close your for loop its missing a )

for (var j = i; j < (myName.length + i) ++j;  <==


Thank you for your reply, but unfortunately its the same two errror message as above :confused:


After put the closing ) change also that

if (text[i] === myName[0])


if (text[i] === "L")


Thanks for the help, I made it with and without the [] brackets but its still the same


for (var j = i; j < (myName.length + i) ++j; {


This looks like it could be your problem. for loops need to have this kind of syntax:

for(starting value; ending value; change) {


Right now you don't have the change separated from the ending value, also the right parenthesis needs to close the for statement