Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

pls describe the issue detail, i am stuck here pls

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(sum){
  

// User Editable Region

  const sum=(5,10);
  return sum;
}
console.log(sum);

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

hi and welcome to the forum!

We’re here to help, but let’s start with you telling us what you were hoping to do in this step.
For eg. you can start by describing what the addTwoNumbers function is supposed to do in your own words?

pls help me in easy words ok

function addTwoNumbers(sum){
const sum(5,10);
return sum;
}
console.log(sum);
help in what is the problem

I believe the problem is that you did not understand what addTwoNumbers is supposed to do yet?
But I cannot be sure if you will not answer my question.

What do you think this function is supposed to do?

ihave this problem You should have a function called addTwoNumbers .

yes great. That much is true.
But what do you think is the purpose of this function?

i dont understand what he wants

pls help me in this task he took so much time

I really want to help you but I cannot make it take any less time unfortunately.

This is a two-way conversation. You tell us what you know, and we help you if what you know is not correct.

The instructions were:

Declare a function named addTwoNumbers . This function should take two arguments and return the sum of those two arguments.

So based on this, what should addTwoNumbers do? Why are we writing it?

this based on the sum of two argument

yes, that’s true.
The addTwoNumbers function is supposed to take two numbers (or arguments) and sum them. That means it should add them.

So do you know how to create a function called addTwoNumbers and make it expect 2 arguments?
(then make it add them and return the result of the addition?)

look this is it right or not
function addTwoNumbers(){

return sum(5,10);

}

const addTwoNumbers=sum;

console.log(sum);

it is not correct.
Please read this:

const sum=addTwoNumbers(5,10);

function addTwoNumbers(a,b){

return sum(a+b);

}

const sum = addTwoNumbers(5, 10);

console.log(sum);

nicely done!
But you should not have two const sum. only one of those is needed.

1 Like

no i not pased he said always me that
You should have a function called addTwoNumbers .
function addTwoNumbers(a,b){

return sum(a+b);

}

const sum = addTwoNumbers(5, 10);

console.log(sum);

oh one more thing to fix

to return the sum, you just need to use the plus sign
the word sum is not supposed to be there
(the sum of something is the addition of two or more numbers)

so just change the return line to return the addition of a and b (don’t put the word sum there)

1 Like

thanks a lot of you. you so nice

1 Like

Mod edit: solution removed