Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

says i need a function called addTwoNumbers which returns the sum of the 2 numbers. ive tried console.log to get the sum, returning the sum, changing the variable names. Nothing seems to work and i dont understand whats wrong.

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(Num1 , Num2) {
 sum = Num1 + Num2;
return sum
}
let Num1 = 5;
sum Num2 = 10;
addTwoNumbers(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 (X11; Linux x86_64) 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

the function looks fine but the variables really should not start with a capital N.
(you should use camel-case when writing a variable name)

Also the line that says sum Num2 = 10 is not valid javascript, so remove that.
Also remove the let Num1 = 5 as you are not using it.

an other thing you need to do, if you want to use this line, is to declare sum with const or let

i made some changes to the code and its still not working. Num1&2 changed to lowercase. Removed the “let num1 = 5” and added let to sum.

const character = “#”;
const count = 8;
const rows = ;

function padRow(name) {
return name;
}
function addTwoNumbers(num1 , num2) {
let sum = num1 + num2;
return sum
}
addTwoNumbers(5, 10);
console.log(sum);

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);

You forgot to assign the return value from calling addTwoNumbers to a new variable sum.