Learn Introductory JavaScript by Building a Pyramid Generator - Step 22

Tell us what’s happening:

I’m stuck with this pop() method, I don’t know how to log it!

Your code so far

let character = 'Hello';
let count = 8;

// User Editable Region

let rows = ["Naomi", "Quincy", "CamperChan"];
let popped = "Meg";

// 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/ Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 22

> Blockquote

Declare a popped variable, and assign it the result of rows.pop() . Then, log your popped variable.

You have declared the variable popped but you’ve assigned it an arbitrary value (‘Meg’). You should declare it with the value specified in the instructions above.
Then you should simply console.log() the variable in the following line.

What value was specified in the instructions? And please use layman’s terms I’m new to JavaScript! @igorgetmeabrain

The .pop() method automatically returns the popped value.


let array = [1, 2, 3, 4, 5];
console.log(array.pop()); // 5
console.log(array); // [1, 2, 3, 4]

The instructions might seem a little ambiguous (because of the nature of the .pop() method), but simply assign the exact value given as given in the instructions to the variable popped.

1 Like

Thank You @igorgetmeabrain, that’s very helpful, I should pay attention to instructions next time. Thank You Very Much. Very Appreciated!

1 Like