6.Log it!


#1


Oops, try again. There was a problem with your syntax.
var text = "Hi how are you ? My name is Milos you might have met several people called Milos in your life but I am a little different type of Milos";
var myName = "Milos";
var hits = [] ;
for (var i=0; i < text.length ; i++ ) {
 if ( text[i] === "M" ) {
 for (var j=i ; j <= (i + myName.length) ; j++ ) {
     hits.push(text[j]) ;
 }
 }   

}
 if (hits.length is === 0 ) {
     console.log ("Your name wasn`t found") ;
 } else {
     console.log(hits) ;
 };


#2

=== means is equal, not sure why you also need to use is, it is not part of js syntax


#4

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