Number 4 Please


#1



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


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++);
}


#2

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") {


#3

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


#4

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")
}


#5

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

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


#6

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)


#7

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.


#8

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.


#9

hiii
when there is many line of text and you wanna find your name then you have to use it.
example:
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
text[i]===c
it can be text[0]==="c" or text[100]==="c"

Hope you've undestand :slight_smile:

@cdethis