Lesson 5


I just don't understand this lesson at ALL. The tutorial on the lesson didn't really help me out much at all and i just don't know what to do at all. I am really confused and stuck.

Someone please explain what the following code does to me, i just copied and pasted what they had on lesson 1 and tried to understand it but i still don't get it. Mainly i don't understand the if statement bit and everything after that step.

/*jshint multistr:true */

var text = "Dipesh, Dipesh, Dipesh, Dipesh, Dipesh, Dipesh";

var myName = "Dipesh";

var hits = [];

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


such answers are time consuming to write, have you looked on the forum? there are some good explanations like this one or this one

(not to be selfish, i know they are answers i wrote, but i have them stored in a file)

If after reading those you have still specific questions, you can ask them


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