Your Second For Loop


I need help as I have no idea what to do. My mind just cannot handle Javascript. Please help me...

It says that there is a problem with my syntax and I don't know what to add.

var text = "My name is Mirain \
. It's a Welsh name.";
var myName = "Mirain";
var hits = [];
for (var i = 0; i < text.length; i++) {
if (text[i] === "K"){
    for (var j = i; j < (i + myName.length); j++);{
    if(hits.length === 0) {
        console.log("Your name wasn't found!")
    else {
    for(var i = 0; i < text.length; i++){
       if(text[i] === "M"){
         if(i + myName.length);
           for(var j = i; <text.length; i++){


The first if statement, I am assuming should check for "M" not "K", since your name is Mirain. You accidentally added a semicolon at the end of the first for loop. You also should not have a semicolon after the else bracket. And the last for loop contains many errors too, but it is not necessary for this exercise so you can just remove it. I would also strongly suggest that you format the brackets better, it won't cause errors having them lined up, but it makes the code harder to read.

Your mind can handle javascript or any programming language as long as you are determined and put in the time and effort to learn it, it's like anything else. I recommend maybe reviewing some of the basics of the javascript syntax and getting that down solid before moving on to more advanced concepts, doing that will save you some frustration in the future. You could also get a book to learn from and learn from that as well as something like codecademy. This site maps out a good progression that I am following now:


No semicolon needed.

Tag is touching variable, and incrementing i instead of j.