Learn Introductory JavaScript by Building a Pyramid Generator - Step 54

Tell us what’s happening:

I’ve tried many codes but none of them worked and I don’t know how to pass.

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(sum) {
  return sum;
 
};

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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 54

Your addTwoNumbers function should return a sum of two numbers
which means your return statement should include a mathematical operation adding two numbers. Therefore, you need to have two parameters that will represent addTwoNumbers(5, 10) arguments.

Also, it would be best to assign the sum variable the addTwoNumbers function call with the arguments.

“This function should take two arguments and return the sum of those two arguments.”

How many arguments does your function take? What does it return?

Thank you for your reply.
Do you mean the code is like the below one??
function addTwoNumbers(num1, num2) {

return sum;

};

Yes, but the return statement should be a mathematical operation adding the two parameters and not the sum variable.

Thank you for your advice.
I finally got it !!!

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