Learn Introductory JavaScript by Building a Pyramid Generator - Step 54

Tell us what’s happening:

need help with this i dont get the instructions so please dont repeat it just tell me in a simple terms, if i dont reply i prob solved it by myself already.thx

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(sum){
  let sum = 5 + 10;
}
addTwoNumbers(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/126.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 54

Hi there and welcome to our community!

You should be creating a function which can return the sum of any two numbers. Your function doesn’t return anything. It just declares a variable (sum) with the value 15.

The function will need two parameters, and should have a return statement which returns the sum of any two numbers which are supplied as arguments to those parameters.

For instance, addTwoNumbers(5, 10) should return 15, whilst addTwoNumbers(20, 30) should return 50.

Outside the function, you should declare the variable sum and assign it the function call addTwoNumbers(5, 10).

Finally, you should log sum to the console.

1 Like

Ye i figured it out after posting this and playing with the code and testing x,y but still thanks.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.