Need help with 5/7 second for loop


hey guys, hope your coding is going well.
I have reviewed my code over and over and I feel that it's right. can someone please tell me where I went wrong?

var text = "ScopE Software Solutions was developed by bobkevin & along with david d'hont. bobkevin is the founder and david is the cto";

var myName = "bobkevin";
var hits = [];

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

[HELP]- 5/7 (Your second "for" loop)

I moved your post to a new topic, and then i formatted your code, take a look. Well, the problem is already in your first loop:

for (i = 0; i >= text.length; i++)

for a loop to execute, the condition should be true. this one is false: i >= text.length, the problem here is that i = 0; and text.length is a lot (more then 100 if i had to guess), i would use < instead



you should also console.log() your hits array



(optional choice)

you can attach .join(' ') to hits inside console.log(); so when it gets logged, the content inside the hits array gets joined by the spaces making it appear as one word or seperate joined words if there is more than one value stored in it.


Thank you so much :smile: ran like a champ


Arigato :smiley: saw my error much later