7. Victory: Browser window problem



I can pass the assignment, and there is no error message. Still, the "browser window" only shows the 2 brackets [ ] from the hits array. No letters or anything. Why?

/*jshint multistr:true */
var text = "Hello my name is Louis. What is yours? \
            Louis is a great name!" 

var myName = "Louis"
var hits = []

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

if(hits.length = 0) {
    console.log("Your name wasn't found!");

else {


this line:

if(hits.length = 0)

you set the length of hits to zero, instead of comparing the length of hits with zero


But what do i have to write if i want to compare the length of hits with zero, then?


i was hoping i didn't need to explain that, already in the first track assigning (single equal sign) and comparing (2 or 3 equal signs) variables is explained.


Thanks. I actually discovered that 2 seconds ago, after i wrote to you. Sorry, i need to be more patient.


it is, hm.. not sure what the right word is, fun? to see how i sometimes try to push people in the right direction, by showing them there mistake, but rather then take a moment to think about this, and how they could solve it. they ask a follow up question rather quickly.


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