Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

I don’t know what I’m supposed to do. I don’t understand

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(a;b);{
return sum
}
const 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/127.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Hi there!

You have a function with parameters a and b. And your function is returning sum variable.
After that you declared the variable sum using const keyword.
Also your function have semicolon between the a and b and after that.
Recheck the instructions and compaire your code with that.

Example

function sumOfTwoNumbers(param1, param2) {
// return the sum of your both param
}

/* Declare the variable sum and assign it the value of the above function call with two numbers as a arguments */

Hi there,

There are some terms you need to get familiar with.

For example, this is a function definition:

This function above takes in one parameter (name) and return back that parameter.

  • padRow("John") will return the string "John"
  • padRow("Jane") will return the string "Jane"

name (the one inside the parentheses () in the function definition) is called parameter

"John", and "Jane" - the specific value of name - is called argument

padRow("John") is a function call


A function can take more than one parameter. The parameters will be separated by commas (,). For example:

function introduce(first_name, last_name) {
   return "Hello, my name is " + first_name + " " + last_name;
}

This function definition has 2 parameters: first_name and last_name

This function call introduce("John", "Doe") will return the string:

"Hello, my name is John Doe"

Now, what you need to do is writing a function that take 2 parameters and return the sum of those 2.

1 Like

Thank you! I was so frustrated trying to get through this step, and your advice finally helped me solve it.

1 Like