Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

Not too sure what is wrong with my code here. But i have a feeling its something to do with my “sum” variable. Can anyone help? functions are killing me right now :frowning:

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(5, 10) {
  return 5 + 10;
}
const sum = addTwoNumbers
console.log(sum);

// User Editable Region


const call = padRow("CamperChan");
console.log(call);


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

let result = ""

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

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

I think you interpreted the instructions the wrong way.

Where you have 5 and 10, you should have parameters to represent the arguments. Then when assigning the function call to the sum variable, you should have your arguments.

please can you help with a more in-depth explanation, i’m keen on understanding my error. How do i have “parameters to represent the arguments”? Also, why and how does this differ from when i am assigning the function to sum variable?

So, the values here, shouldn’t be actual values, but a representation of actual values (what we call parameters in js), they should be variable names that hold values, in this case, the values are 5 and 10.

The actual values (5, 10) should be placed in this function call.

1 Like

Thank you for your help, I now have a better understanding of parameters and arguments :pray:t5:

1 Like