Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

You should assign sum the value from calling the addTwoNumbers function with 5 and 10 for the arguments.

Help

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(a, b) {
  return a+b;
}
addTwoNumbers(a,b);
let a = 5;
let b = 10;
const sum = (5+10);
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

you should assign whatever this line of code returns to sum
but you should pass 5 and 10 to the addTwoNumbers function so it can add them for you.

1 Like
function addTwoNumbers(5, 10) {
  return a+b;
}
addTwoNumbers(5,10);
let a = 5;
let b = 10;
const a+b = (5+10);
console.log(a+b);

Like this?

no your original function was correct.
the problem was what you wrote after the function.

1 Like

i still do not understand

Instead of assigning 5 and 10 to the variables a and b, just pass 5 and 10 as arguments to the function.

Assign that function call to sum, not (5+10).

It’s all one line. Instead of this:

Use this syntax:

const variable = function(arg1, arg2)
1 Like

Thanks so much @hbar1st and @pkdvalis :smile: :partying_face:

1 Like