Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

I have been stuck on this problem for a while, and I just don’t know what to do. Its telling me to add a function called addTwoNumbers with two arguments, 5 and 10. I made a var called sum like iit told me and it equals what I THINK is what it should equal. (it could be tottaly wrong.) I have tried looking on the forum for answers but I can’t really find anything usefull. Ovbiously these things are usefull I just can’t put the things together to make the test sucseed. Thanks!

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

function addTwoNumbers(5 + 10) {

const sum = addTwoNumbers(5 + 10);
return 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 (Macintosh; Intel Mac OS X 10_15_7) 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

to create a function that takes 2 values as parameters you need to do something like this:
function myFunction(a, b) { }

What you have done is not a function that takes 2 parameters since you just typed 5+10 in the parenthesis instead of typing the name of two parameters.

Once you’ve created the function correctly, the next step is to use the parameters inside the function to do something interesting and then return the result of that.
so for example, here is a function that takes two strings and returns one string which is the combined words.

function combo(part1, part2) {
 return part1+' '+part2;
}

if you test this like this:
console.log(combo('hello', 'world));
will show this in the console:
hello world

hope you can try this one again after resetting the code.

1 Like

Oh wow, thanks so much! This makes a lot more sense then what I was doing, lol

1 Like

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