Lesson 6 Crashes my browser, doesn't output text properly


I run this, and it crashes my browser. I more or less copied the format directly for the example at the beginning. What do you think I'm doing wrong?

Thanks for your help!


/*jshint multistr:true */

text = "Let's try this search, Nate.";
var myName = "Nate";
var hits = [];

for (var i = 0; i < text.length; i++) {
  if (text[i] === "N"){
      for (var j = i; j < (myName.length + i); j++){
if (hits.length===0){
    console.log("Your name wasn't found!")
} else {


Well first off you need just three = not four so it would be hits.length === 0. If I had to guess that would be the problem. Also, your set up above that seems to be off in some cases like instead of

it would seem you would need to have j < (myName.length + i);


Thanks! Fixed these but it still crashes :frowning:


Fixed the post! Closing :slight_smile:


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