diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 7374a1198e2..c9fe468966c 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -50,35 +50,14 @@ We've defined a function `countOnline` which accepts one argument, `allUsers`. U The function `countOnline` should use a `for in` statement to iterate through the object keys of the object passed to it. ```js -assert( - __helpers.removeJSComments(code).match( +assert.match( + __helpers.removeJSComments(code), /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ - ) ); ``` The function `countOnline` should return `1` when the object `{ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }` is passed to it -```js -assert(countOnline(usersObj1) === 1); -``` - -The function `countOnline` should return `2` when the object `{ Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } }` is passed to it - -```js -assert(countOnline(usersObj2) === 2); -``` - -The function `countOnline` should return `0` when the object `{ Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } }` is passed to it - -```js -assert(countOnline(usersObj3) === 0); -``` - -# --seed-- - -## --after-user-code-- - ```js const usersObj1 = { Alan: { @@ -91,7 +70,12 @@ const usersObj1 = { online: false } } +assert.equal(countOnline(usersObj1), 1); +``` +The function `countOnline` should return `2` when the object `{ Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } }` is passed to it + +```js const usersObj2 = { Alan: { online: true @@ -103,8 +87,12 @@ const usersObj2 = { online: true } } +assert.equal(countOnline(usersObj2), 2); +``` +The function `countOnline` should return `0` when the object `{ Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } }` is passed to it +```js const usersObj3 = { Alan: { online: false @@ -116,8 +104,11 @@ const usersObj3 = { online: false } } +assert.equal(countOnline(usersObj3), 0); ``` +# --seed-- + ## --seed-contents-- ```js