Whats wrong with my code?


#1



Replace this line with your code. 
var text="I am jay, i am a good jay";
var myName="jay";
var hits=[];
for(var i=0; i<myName.length;i++)
{
      if(myName[0] === 'j')
      {
      }
      
}


#2

HI you should go back to the Lesson: Your first "for" loop to see how your for loop should be.


#3

i am not able to understand the logic is my logic correct atleast?


#4

Yes, but you should loop through text instead of myName


#5

i got it! thanks:heart_eyes:


#6

i am stuck again here :: url ::https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/5?curriculum_id=506324b3a7dffd00020bf661#

my code::
ar text="I am jay, i am a good jay";
var myName="jay";
var hits=[];
for(var i=0; i{
if(text[0] === "j")
{
for(var j=i; j {
hits.push("hello");
}
}

}


#7

Hi you should format your code and post all your code


#8

i am not knowing exactly what we are doing in this project can you give me some insight on whats going on in this project??


#9

...........On what project?


#10

search text for your name in for loop!


#11

Do you know what is for loop?
and why does we use it?

@jay8978


#12

The Lesson is to make a code that search for your name inside a text and print it.


#13

@rcodeman i do know it, its used for doing repeated tasks and for looping!


#14

good! :slight_smile:
do you know for loop syntax?

@jay8978


#15

for( var i; i<10;i++)
is one of the example


#16

Post your code correctly


@jay8978