fix(curriculum): format challenge markdown as per linting rules (#36326)

* fix: Format challenge markdown according to linting rules

* fix: Put spaces after section tags
This commit is contained in:
Oliver Eyton-Williams
2019-07-18 17:32:12 +02:00
committed by mrugesh
parent c387873640
commit 7d4dc382b4
63 changed files with 257 additions and 156 deletions

View File

@ -6,6 +6,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:
```js
@ -19,12 +20,14 @@ Jeff
Sarah
Ryan
```
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> Objects do not maintain an ordering to stored keys like arrays do; thus a key's position on an object, or the relative order in which it appears, is irrelevant when referencing or accessing that key.
</section>
## Instructions
<section id='instructions'>
We've defined a function <code>countOnline</code> which accepts one argument (a users object). Use a <dfn>for...in</dfn> statement within this function to loop through the users object passed into the function and return the number of users whose <code>online</code> property is set to <code>true</code>. An example of a users object which could be passed to <code>countOnline</code> is shown below. Each user will have an <code>online</code> property with either a <code>true</code> or <code>false</code> value.