Your Second "for'' Loop


An error that says: 'Oops, try again. There was a problem with your syntax.' keeps popping up. This shows on the black screen: 'SyntaxError: Unexpected end of input'

Replace this line with your code. 
/*jshint multistr:true */
var text = "Mesonma, Mesonma, Mesonma, whatever, fun";
var myName = "Mesonma";
var hits = [];
for (i=0; i<text.length; i++){
    if (text[i] === 'M'){
        for(var j = i; j<i+myName.length; i++){


HI this line

for(var j = i; j<i+myName.length; i++)

you should increase j++ instaed of i++


This is the error to focus upon since it is the compiler raising it. The error generally indicates a missing curly brace so let's look for that.

There are three { and only two }. The if statement is not closed.


We never write semi-colons after } unless it closes an object literal or a function expression.

var myObject = {


var myFunc = function () {



I changed it now, but it's still giving me the same error.


Now read the post made by @mtf


Ok, yes this helped. Thank you both.


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