Find Your Name 6/7


#1



var texte= ("Craziest Fights Yassine in Football History featuring red cards, horror fouls and dirty tackles from around the world.");
var monNom = ("Yassine");
var trouve =[ ]

    for (var i = 0; i< texte.length; i++) 
        if (texte[i] === "Y") {
            for (var j = 1; j < (i + monNom.length); j++)
            console.log(trouve)
}

if(trouve.length === 0) {
    console.log"Votre nom n'a pas été trouvé !");
}
    else {
        console.log(trouve);
}

Hi, this is my code, and when i want to check if it's true, it's write "SyntaxError: missing before statement". Can you help me ?


#2

There are a couple of things:

var texte= ("Craziest Fights Yassine in Football History featuring red cards, horror fouls and dirty tackles from around the world.");
var monNom = ("Yassine");
var trouve =[ ]                                      //  <- no semicolon

    for (var i = 0; i< texte.length; i++)         //       <- this for-loop has no opening and closing brackets
        if (texte[i] === "Y") {
            for (var j = 1; j < (i + monNom.length); j++)          // <- same for this for-loop
            console.log(trouve)                                          //  <- no semicolon
}

if(trouve.length === 0) {
    console.log"Votre nom n'a pas été trouvé !");                              // <- look closely at the parenthesis 
}
    else {
        console.log(trouve);
}