Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

please help with hard-coded values. Once I change the numbers into the arguments it gives undefined

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region


function addTwoNumbers(a,b){
  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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Welcome to our community!

You should return a sum of the arguments, not the numbers.

Here, add the two required numbers as arguments to the function addTwoNumbers()

2 Likes

Thank you , I did all the correction it still tells me that the functions returns a hard-coded value.

show your code for more help, we can’t help without seeing what you have written

Hi @zanemoshabane

You need to return the parameters passed to the function.

Happy coding

1 Like