Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>=</code> is assignment, but in conditional statements you need to check for equality (<code>==</code>), check if something is greater (<code>&gt;</code>), check if something is less (<code>&lt;</code>) etc. You are assigning the variable <code>j</code> the length of <code>myName</code> rather than checking some condition on this line:</p> <pre><code>for(var j = i;j = myName.length;){ </code></pre> <p>Instead you probably need to do something like this:</p> <pre><code>for(var j = i;j &lt;= myName.length;){ </code></pre> <p>However, this may not necessarily be the solution to your Codecademy Assignment, but it will solve your specific javascript error. play around with and read up on <code>&lt;</code>, <code>&gt;</code>, <code>==</code> and the other conditionals mentioned <a href="http://www.w3schools.com/js/js_comparisons.asp" rel="nofollow">here</a> to try to figure out what works.</p> <p><strong>Edit:</strong> if you wanted a solution to your entire problem, it would have been helpful to post a link to the problem in the question and not only mention the specific error you were getting, but explain the entire question. That being said, you missed a few things here:</p> <ol> <li>You were doing assignment instead of checking a condition as I explained above.</li> <li>You forgot to increment <code>j</code> in your <code>for</code> loop as Franklin mentioned in the comments. You need to do <code>j++</code>.</li> <li>You are not stopping at the correct point in the string. As Codecademy says, "...your second <code>for</code> loop should stop when it reaches its current point in the string + <code>myName.length</code>." This means that you need to stop at <code>text.length + myName.length</code> instead of just <code>myName.length</code>. That also means you should use <code>&lt;</code> rather than <code>&lt;=</code> as I recommended above.</li> </ol> <p>Putting all of that together, the solution is to put this line:</p> <pre><code>for(var j = i;j &lt; (text.length + myName.length); j++){ </code></pre> <p>in place of of this line:</p> <pre><code>for(var j = i;j = myName.length;){ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload