Learn Introductory JavaScript by Building a Pyramid Generator - Step 54

Tell us what’s happening:

Before moving on, take a moment to review how functions work.
Declare a function named addTwoNumbers. This function should take two arguments and return the sum of those two arguments.
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.
That is the problem and I answered this:
function addTwoNumbers(num1, num2){
return num1 + num2;
}
let sum = addTwoNumbers(5, 10);
console.log(sum);

Your code so far

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

function padRow(name) {

// User Editable Region

  return name;

function addTwoNumbers(num1, num2) {
  return num1 + num2;
}

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 54

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

1 Like

You have this return name; line randomly floating above your function. It seems that you accidentally deleted a closing brace above your new function

This is how you write the code for this Part, functions are tricky so observe them very carefully

SOLUTION REMOVED

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like