Files

1.7 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
660f207334fabaeac3269c38 Step 41 1 step-41

--description--

To manipulate the result string, you will use a different type of loop. Specifically, a for...of loop, which iterates over each item in an iterable object and temporarily assigns it to a variable.

The syntax for a for...of loop looks like:

for (const value of iterable) {

}

Note that you can use const because the variable only exists for a single iteration, not during the entire loop.

Create a for...of loop to iterate through your rows array, assigning each value to a row variable.

--hints--

You should use another for keyword.

assert.lengthOf(__helpers.removeJSComments(code).match(/for/g), 2);

You should declare a row variable.

assert.match(__helpers.removeJSComments(code), /\s+row\s+/);

You should use const to declare your row variable.

assert.match(__helpers.removeJSComments(code), /const\s+row\s+/);

Your for...of loop should declare your row variable.

assert.match(__helpers.removeJSComments(code), /for\s*\(\s*const\s+row\s+/);

Your row variable should be extracted from rows using the of keyword.

assert.match(__helpers.removeJSComments(code), /for\s*\(\s*const\s+row\s+of\s+rows\s*\)/);

Your for...of loop body should be empty.

assert.match(__helpers.removeJSComments(code), /for\s*\(\s*const\s+row\s+of\s+rows\s*\)\s*\{\s*\}/);

--seed--

--seed-contents--

const character = "#";
const count = 8;
const rows = [];

for (let i = 0; i < count; i = i + 1) {
  rows.push(i);
}

let result = ""

--fcc-editable-region--

--fcc-editable-region--

console.log(result);