Webpage doesn't respont


#1


After I click on "Save & Submit code", webpage doesn't respond.



#2

you have an infinity loop, that causes the page the freeze

can you copy paste your code to the forum?

What version of windows are you using?


#3

/*jshint multistr:true */
var text = 'gskxne djwjbfhe Arkember shxnsm Arkember cjcjddn Arkember';
var myName = 'Arkember';
var hits = [];

for (var i = 0; i < text.length; i++) {
  if (text[i] === 'A') {
    for (var j = i; i < (i + myName.length); i++) {
      hits.push(text[i]);
    }
  }
}

#4

your second loop:

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

check if i + something is greater then i, while increasing i. since i will increase, this condition never becomes false.


#5

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