Codecademy lesson troubles
<p>I am learning JavaScript through Codecademy, but I have an issue. The code below is supposed to search through the <code>text</code> variable for my name in the <code>myName</code> variable and then push all of the individual letters to the <code>hits</code> array. The code that I have written is not correct but Codecademy says that it is correct and is going to let me move on in the lesson.</p>

<p>I have been trying to solve the issue that I am having with no luck. The problem is that when I run the <code>hits.push(text);</code> line it will output the entire variable but I have tried <code>hits.push(text[i]);</code> and get undefined for the result. Can someone please help me understand where I have made the mistake?</p>

<pre><code>/*jshint multistr:true */
var text = "XsddfasASSFABrandonSFsdfdasBrandonsddfadfaBrandon";
var myName = "Brandon";
var hits = [];
for (i=0; i&lt;=text.length;i++){
    if (text[i]===myName[i]){
        for(var x=i; x&lt;i+myName.length;x++){
            hits.push(text);
        }
    }
}
if (hits.length===0){
    console.log("Your name wasn't found!");
} else {
    console.log(hits);
}
</code></pre>
