5/7 Lets break it down!


#1

So this is my code:

var text = "eok eok oek oke Rem oek oek oke oke Rem oke Rem";
var myName = "Rem";
var hits = []

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

I want to talk about this:

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

So i f I'm correct j = i; says that j is now the same as i and starts at 0 because the letter R was founded. Now this part:

j < i + myName.length;

I have actually no idea what it says. From my understanding it says: J is smaller than i + 3 (My name is Rem). I HAVE NO CLUE WHAT THAT MEANS. What does it do??? I'm confused. Correct me if I'm wrong cheers!


#2

yeah its confusing i am working on it too.maybe in sometime i will solve that.
GOOD POINT:grinning:


#3

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