Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

Not sure where I’m going wrong. I’ve declared the variable “sum”. Assigned the value of 15 to the variable. I’ve called the function and entered 10 and 5 into its parameters as the argument and ive logged the sum variable. Need some guidance

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

const sum = 10 + 5;
function addTwoNumbers(10, 5){
return 10, 5;
}
addTwoNumbers(sum);
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 + row + "\n";
}

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/137.0.0.0 Safari/537.36 Edg/137.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Welcome to the forum @NewbieWithManBoobies

You have a message in the console.

SyntaxError: unknown: Unexpected token (12:23)

  10 |
  11 | const sum = 10 + 5;
> 12 | function addTwoNumbers(10, 5){
     |                        ^
  13 | return 10, 5;
  14 | }
  15 | addTwoNumbers(sum);

Read the instructions carefully. You need to use parameters for the function.

The sum variable is not calling the function.
Your code needs to use the function to work out the maths.

Have a look at the padRow function.

Happy coding

Learn Introductory JavaScript by Building a Pyramid Generator: Step 55 | freeCodeCamp.org

Is this better? I’m not sure how to have the screenshot of my code come up so I copied the link lol.

const sum = addTwoNumbers(5, 10)

function addTwoNumbers(5, 10){

return 5 + 10;

}

addTwoNumbers(5, 10);

console.log(sum)

still getting syntax errors for this

5 and 10 are not valid parameter names, you need to use valid parameter names (which have the same rules as variable names)