Learn Introductory JavaScript by Building a Pyramid Generator - Step 27

Tell us what’s happening:

Step 27
Another method essential for this project is the .pop() method. It removes the last element from an array and returns that element.

When a method returns a value, you can think of it as giving the value back to you, making it available for use in other parts of your code.

Create a new variable called popped and assign it the result of rows.pop(). Then, log popped to the console.
i don’t understand this Question?

Your code so far

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

// User Editable Region

let rows = ["Naomi", "Quincy", "CamperChan"];
rows.push("freeCodeCamp");
rows.pop("freeCodeCamp");
console.log(rows);
rows.push("popped");
console.log(rows);
rows.pop("popped");
console.log(rows);
let popped = ["Naomi"]
popped.push("FreeCodeCamp");

popped.pop("FreeCodeCamp");
console.log(popped);
popped.pop;
console.log(popped);




// 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 Edg/130.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 27

Hi. I suggest you reset the step to get your code back to how it was.

You only need to add 1 line of code here, You have created a variable called popped but you haven’t assigned it the value stated in the instructions. A value is just something stored within a variable name. It can be a string, a calculation, a method, a number. In this case they have told you what they want you what to assign. You are possibly confused by the statement that you assign the result, so you are working out the result and putting that. However they want you to arrive at the result by the method stored in the variable.

You have the console log right but only need to right it once.

1 Like

Thank You so much for answer i begin start learning JavaScript at FreeCodeCamp so i feel love it.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.