Back to Freecodecamp

Step 5

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

latest1.3 KB
Original Source

--description--

The <dfn>console</dfn> allows you to print and view JavaScript output. You can send information to the console using console.log(). For example, this code will print "Naomi" to the console:

js
let developer = "Naomi";
console.log(developer);

The code above accesses the developer variable with its name in the console.log(). Note that the value between the parentheses is the value that will be printed.

Print the value of the character variable to the console. Then, click the "Console" button to view the JavaScript console.

--hints--

The character variable initialization should not be changed.

js
assert.strictEqual(character, 'Hello');

You should access the console in your code.

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

You should access the log property of the console.

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

You should use parentheses to call the .log() method.

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

You should print the character variable to the console.

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

--seed--

--seed-contents--

js
--fcc-editable-region--
let character = 'Hello';

--fcc-editable-region--