You are viewing a single comment's thread.

view the rest of the comments →

[–] [deleted] 0 points 3 points (+3|-0) ago 

[Deleted]

0
1

[–] fluffingtonthefifth [S] 0 points 1 point (+1|-0) ago  (edited ago)

So in the nested for loop, could I replace the i in j < (myName.length+i) with 1? That is, would

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

work the same, or is there a reason to put + i in the instructions?

(Edit: I tested the above and it returns "Your name wasn't found!" I'm trying to understand why + i is necessary in the above code.)

I've tried to learn other languages before (Python and Java), but I'd hit a wall at some point. That doesn't seem to be happening with JS. I'm sticking with it until I master it, in the hopes that it translates to understanding other languages better. A book recommendation would be welcome!

[–] [deleted] 0 points 1 point (+1|-0) ago  (edited ago)

[Deleted]