Back to Freecodecamp

Step 20

curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660f061d259bbebc37461080.md

latest1.2 KB
Original Source

--description--

You can access the values inside an array using the <dfn>index</dfn> of the value. An index is a number representing the position of the value in the array, starting from 0 for the first value.

You can access the value using <dfn>bracket notation</dfn>, such as array[0].

Use console.log and bracket notation to print the first value in your rows array.

--hints--

You should have a console.log() statement in your code.

js
assert.match(__helpers.removeJSComments(code), /console\.log/);

You should access your rows array.

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

You should use bracket notation with your rows array.

js
assert.match(__helpers.removeJSComments(code), /rows\[/);

You should use bracket notation to access the first element of your rows array.

js
assert.match(__helpers.removeJSComments(code), /rows\[\s*0\s*\]/);

You should log the first element of your rows array.

js
assert.match(__helpers.removeJSComments(code), /console\.log\(\s*rows\[\s*0\s*]\s*\);?/);

--seed--

--seed-contents--

js
--fcc-editable-region--
let character = 'Hello';
let count = 8;
let rows = ["Naomi", "Quincy", "CamperChan"];

--fcc-editable-region--