PLEASE HELP! Guys. Can you please tell me what is wrong with the code. It gives me the whole name instead of the letters. it doesnt hit properly


#1


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


It gives me the full name in the amount that equals to the variable text's length.


/*jshint multistr:true */
var text = "Hey, how are you? Your name is Reyan isn't it? Yes,\
my name is Reyan. How are you? I'm good. Blah Blah Blah Blah bla\
Have Fun Reyan.";
var myName = "Reyan";
var hits = [];
for ( var r = 0; r < text.length; r++){
    if (text[r]=== "R" ){
        for(var x= r ; x < myName.length+r ; x++ ){}
        }
        (hits.push("Reyan"));
        hits[0];
}
if(hits.length === 0){
    console.log( "Your name wasn't found");
    }
    else {
        console.log(hits);
        } 

Thanks guys!


#2

that's why.

you just created a loop here and did nothing. Please revise that bit


#5

Okay, I got it. Thank you so much!


#6

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