Learn Introductory JavaScript by Building a Pyramid Generator - Step 3

Tell us what’s happening:

Please help me get through the second step. Why doesn’t my code pass verification?
The task is: “Initialize your character variable by assigning it the value “Hello” during its declaration.”.
The error appears: “You should assign “Hello” to your character variable.”.
My code:

let character;
let character = "Hello";

Your code so far


// User Editable Region

let character;
let character = "Hello";

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 3

Hi there and welcome to our community!

When you declare a variable, you use the let or const keyword to bring it into existence.
Then you can assign it a value, referencing the variable directly (without let or const).

EXAMPLE:

let a;
a = 5

// you can also do this in one line
let a = 5;
1 Like

Hi! Thank you for your warm welcome.
Thanks for the explanation, I understood and corrected the error.

1 Like