Trying to make sense of "your second for loop" equation


/*jshint multistr:true */
var text = "Hello, my name is Bob. I was born and raised in California.\ The name Bob was given by my uncle Sam.\
He kept on calling me Bob over the years because of my height and weight.\ I didn't like the name Bob at first but it grew on me after a while.\ Bob is my name and this is my short story."

var myName = "Bob";

var hits = [];
for (var i = 0; i <= text.length; i++) {
    if (text[i] === "B") {
        for (var x=i; **x<(myName.length + i)**; x++) {

Hi guys, I just don't understand the equation for the second loop. why must x be less than myName.length PLUS i. Hope someone can clarify this for me. Thank you in advance


read this post:


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