Browser crashing when executing double for loop for Search Text


Browser crashes.

var text = "dbgk gfdd Naz egribdb awfesgd \
kjm Naz wweongnir efgg Naz";

var myName = "Naz";

var hits = [];

for (var i = 0; i < text.length; i++) {
    if (text[i] === myName[0]) {
        for (var j = i; j < i + myName.length; i++) {



It should make increment of j. So,


You may be interested in seeing your output. Then, add:



OMG, :@

Thank you so much, you clearly have better attention to detail than me even though i just downed an entire cup of coffee! Thanks, and have a great day amazing one. :smile: :smile:


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