Skip to content

Commit

Permalink
Fix “Handling text — strings in JavaScript” typo
Browse files Browse the repository at this point in the history
Fixes #2959
  • Loading branch information
sideshowbarker committed Mar 9, 2021
1 parent 39c006a commit 4ce26cd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ <h3 id="Numbers_vs._strings">Numbers vs. strings</h3>
<li>Conversely, every number has a method called <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString">toString()</a></code> that converts it to the equivalent string. Try this:
<pre class="brush: js">let myNum2 = 123;
let myString2 = myNum2.toString();
typeof myString;</pre>
typeof myString2;</pre>
</li>
</ul>
These constructs can be really useful in some situations. For example, if a user enters a number into a form's text field, it's a string. However, if you want to add this number to something, you'll need it to be a number, so you could pass it through <code>Number()</code> to handle this. We did exactly this in our <a href="https://github.com/mdn/learning-area/blob/master/javascript/introduction-to-js-1/first-splash/number-guessing-game.html#L54">Number Guessing Game, in line 54</a>.</li>
Expand Down

0 comments on commit 4ce26cd

Please sign in to comment.