I'm not sure what I did wrong


#1



Hey, I'm looking for some help as I really am stuck and would like to know what I did wrong. Thanks for your time.


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


The error message is: SyntaxError: Unterminated template literal


var text = "My name is Greg, I am from Chicago"
var myName = "Greg"
var hits = []
for ( i = 0;i < text.length; i++ )
{  
if (text[i] === "G")
    {
        for (var l = i; l < i + myName.length; l++) {
            
            hits.push('Greg');
            hits[l]
            }    
        
    }
}


#2

Nevermind, I simply forgot to put var infront of i. My bad.


#3

1.you missed many semicolon
and second

if (text[i] === "G"){
for (var l = i; l < i + myName.length; l++) {
hits.push('Greg'); //wrong

so whenever text[i]==="G" it'll run for loop and it'll push "Gerg" into the hits.so what's the benefit of searching.you want to search your name in the text if your name is there then it'll push.
so i would do like
hits.push(text[l]);