fix: typos in JavaScript Algorithms & Data Structures challenges
This commit is contained in:
committed by
Stuart Taylor
parent
3f328b73dc
commit
5bac4d3818
@ -7,7 +7,7 @@ challengeType: 1
|
||||
## Description
|
||||
<section id='description'>
|
||||
Sometimes you may need to iterate through all the keys within an object. This requires a specific syntax in JavaScript called a <dfn>for...in</dfn> statement. For our <code>users</code> object, this could look like:
|
||||
<blockquote>for (let user in users) {<br> console.log(user);<br>};<br><br>// logs:<br>Alan<br>Jeff<br>Sarah<br>Ryan</blockquote>
|
||||
<blockquote>for (let user in users) {<br> console.log(user);<br>}<br><br>// logs:<br>Alan<br>Jeff<br>Sarah<br>Ryan</blockquote>
|
||||
In this statement, we defined a variable <code>user</code>, and as you can see, this variable was reset during each iteration to each of the object's keys as the statement looped through the object, resulting in each user's name being printed to the console.
|
||||
<strong>NOTE:</strong><br>Objects do not maintain an ordering to stored keys like arrays do; thus a keys position on an object, or the relative order in which it appears, is irrelevant when referencing or accessing that key.
|
||||
</section>
|
||||
|
@ -13,7 +13,7 @@ Using spread syntax, we have just achieved an operation that would have been mor
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
We have defined a function <code>spreadOut</code> that returns the variable <code>sentence</code>, modify the function using the <dfn>spread</dfn> operator so that it returns the array <code>['learning', 'to', 'code', 'is', 'fun']</code>.
|
||||
We have defined a function <code>spreadOut</code> that returns the variable <code>sentence</code>. Modify the function using the <dfn>spread</dfn> operator so that it returns the array <code>['learning', 'to', 'code', 'is', 'fun']</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
Reference in New Issue
Block a user