Number 4 Please


It says

Oops, try again. There was a problem with your syntax.

I check other peoples post about this topic too and none of it seems to work can you please tell me how to fix it?

Replace this line with your code. 
var myName = "Jack";
var hits = [];
var text= "Hey there Kiddos";
for(var i = 0; i < text.length; i++);


Try adding this line of code

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

And this line of code to in between the for loops

{ if (text[i] === "C") {


After what I have and in the bracket right?
(Just checking)


Here is my new code and now it is saying that something is wrong with my synax
var myName = "Jack";
var hits = [];
var text= "Hey there Kiddos";
for(var i = 0; i < text.length; i++);
for (var j = i; j < i + myName.length; j++){
{ if (text[i] === "C")


put this in between your two for loops and change C to J

{ if (text[i] === "C")


I changed it and there is still now change in results
I changed the C to J like you says any other ideas (not trying to be aggressive just asking)


All I have in my code is...

var myName = "Cameron";
var hits = [];
for(var i = 0; i < text.length; i++) {
if (text[i]=== "C") {}}

It worked for me but you will just have to change your name so it will work for you.


Hi, why would it be text instead of myName if in the instructions it says " It should check to see whether the current letter is equal to the first letter of your name."
That's the part that confused me.


when there is many line of text and you wanna find your name then you have to use it.
var text=jak ljakjasd kjak alksjd klajdk cdethis jsdkskjskdjkjsdk cdethis jhkhkh.
myName=cdethis // it is what you have to search

finding your name from many line of text its valuable.
why i m using if(text[i]==="c")
if i want to search cdethis from myName
then i knw text[i] means text[0] === c

why i m using for loop because we dont when it'll happen
it can be text[0]==="c" or text[100]==="c"

Hope you've undestand :slight_smile: