Help PLZ 5/7


#1


https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/5?curriculum_id=506324b3a7dffd00020bf661


SyntaxError: missing before statement


var text = " Hello there, how are you\
doing? I am Pierce and I have a secret to\
tell you. I was born and raised in a small town called Pierce. I didnt have many friends except one and his name was ""Pierce".";
var myName = "Pierce";
var hits = [];
for ( var i = 0; i < text.length; i++);
if (text[i] === myName[0]); {
for (var j = i; j < (i + myName.length); j++) {
hits.push(text[j]);
}
}
}


#2

A lot of your code is being treated as a string. You need to escape special characters with a slash...

Example:

var partialString = "I didnt have many friends except one and his name was ""Pierce".";

to

var partialString = "I didnt have many friends except one and his name was \"Pierce\".";

Reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#Escape_notation


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.