Learn Introductory JavaScript by Building a Pyramid Generator - Step 49

Tell us what’s happening:

Why is my code not working, I declared a variable and assigned the padRoe call.

Your code so far

const character = "#";
const count = 8;
const rows = [];

function padRow() {

}

// User Editable Region

const padRows = padRow();

// User Editable Region



for (let i = 0; i < count; i = i + 1) {
  rows.push(character.repeat(i + 1))
}

let result = ""

for (const row of rows) {
  result = result + row + "\n";
}

console.log(result);

Your browser information:

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 49

double check what should be the name of the variable

Hi, @lianavaleria15 :man_with_gua_pi_mao:
Consider these questions:

  • You’ve created a function padRow. What is it doing?

  • You’re then calling padRow() and assigning the return value to the constant padRows. What value is getting assigned to padRows and what is padRows then being used for?

It helps to look through your code line by line and ask what each thing is doing.

those questions are not relevant to pass this step, maybe try yourself first to solve it

1 Like

Thanks for the heads-up. I’m new here, so I’m still trying to figure out some of the nuances. I did look at the link provided for #49, and it says:

Step 49

You are calling your padRow function, but not doing anything with that function call. All functions in JavaScript return a value, meaning they provide the defined result of calling them for you to use elsewhere.

My reply was very much on point with this message. I’m not sure what I’m missing here. :thinking:

Declare a variable named call

What would declaring a variable named call do?

There’s nothing special about the variable name. It’s just that this step asks for it.

1 Like

The variable stores the value that you assigning to it.

The steps ask for

To see the result of calling your padRow function, declare a call variable and assign your existing padRow call to that variable.

how does your paragraph helps with that?

It helps with the thing that I highlighted.

“You are calling your padRow function, but not doing anything with that function call”

To which, my paragraph, as you put it, was completely on point with this comment, the very comment presented to me when I visited the link.

If you read my first comment and then the explanation as to why I commented what I did, it will make sense.

However, I have already acknowledged that I was mistaken somehow due to the unintuitive nature of these message boards and the links they provide.

No, I don’t get it. The issue here was the wrong variable name

When I clicked on the link, it said in the box:

You are calling your padRow function, but not doing anything with that function call. All functions in JavaScript return a value…

I took that to mean, you must do something with the function.

So, with that in mind, my comment helps with what I thought the issue was. The issue (I thought) being that the function was not doing anything.

I have since realized that I was mistaken as to what the issue actually was, as
PauloRodrigues already pointed that out to me, and I acknowledged his comment.

There was no need for further digging into my misinformed response, but I’m happy to explain myself. Hopefully that clears up any confusion.

just create a variable call and assign it to your function call code removed by moderator

hi @khuljohn

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like

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