Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

freeCodeCamp Staff
I beg you to please help me with this.

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(a, b) {}

// 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/131.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Hi there!

return the sum of a and b arguments within the function body {}.
Then declare a sum variable and assign it the value of calling your addTwoNumbers function with 5 and 10 as the arguments. Log the sum variable to the console.

You can ask, if you didn’t understand anything in above.

I don’t understand sir
I need your help

Which part of the instructions are did you not understand? Try to talk about the instructions or code you did’t understand.

Hi @tomasnguyen2009

In the padRow function, function returns the variable passed to it.

In the addTwoNumbers function, you need to return the two variables added together.

Happy coding

I don’t understand anything.
Either you give me the answer OR
You guide me with examples.
Otherwise I am DEAD because I will be stuck forever.
Please help me Teller.

If you don’t understand anything,then copy pasting isn’t learning.
adding a number to another number called sum of two numbers. return the sum of two numbers a and b within the function {} body using return keyword.
Declare a variable sum and assign it the function call addTwoNumbers() and add two numbers as an argument within the function call. Then log the sum variable to the console.
Example:

// function definition 
function myFunc(one, two) {
 //returning the sum of two numbers 
return one + two;
}

/* Declaration of a variable and assigning the function to it */
const add = myFunc(4, 5);
// logging the variable 
console.log(add); // output: 9
1 Like

As @hasanzaib1389 mentioned, you need to put into words the part or parts you do not understand.

Learning to code is frustrating.
So for now, my advice is to take a short break.