Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

Hi
Took me a few minutes but still not sure where I’m missing at.

The errors keep popping up as:
“You should have a function called addTwoNumbers.”

I tried to change the parameters in “addTwoNumbers” function but that might not be where the issue is.

Any advices are greatly appreciated.

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

I could be wrong but 2 things I can see:

  1. You use a function called ‘sum’ but I don’t see that defined anywhere
  2. You may need to end the function definition with a semicolon ;
1 Like

Hi there!

Above you returned a function name sum with two arguments. That’s not requested.

You need to return the sum of your both a , b parameters.

Hint: you need to calculate a and b.

1 Like