Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Tell us what’s happening:

I need help here. I am making an MMORPG. Please help!

Your code so far

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

function padRow(name) {
  return name;
}

// User Editable Region

const sum;
function addTwoNumbers(5, 10);
con

// 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 + row + "\n";
}

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 55

Hi @stordies-llc

SyntaxError: unknown: Missing initializer in const declaration. (11:9)

   9 | // User Editable Region
  10 |
> 11 | const sum;
     |          ^
  12 | function addTwoNumbers(5, 10);
  13 | con
  14 |

You need to address the message in the console.

Happy coding

I don’t understand. please explain.

You first. :slight_smile: Please explain what it is you don’t understand. Can you see the error in the console? Or don’t you understand what the error means?

I’d say
function addTwoNumbers() {
sum = 5 + 10;
}
console.log(sum);

Not sure if you missed this question, it’s quite important to your problem:

You have another console error:

ReferenceError: sum is not defined

Also, how does your code align with this instruction?

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

Your function should not use hard-coded values.

Is sum supposed to be inside our outside of the function body?

Declare a sum variable and assign it the value of calling your addTwoNumbers function

If you are going to declare a variable and assign the result returned by calling the function, would you declare the variable inside or outside the function?

function addTwoNumbers(sum) {

Ok…

Declare a sum variable and assign it the value of calling your addTwoNumbers function with 5 and 10 as the arguments.

You are passing “sum” as an argument to the function.

let this = 0; //declare a variable and assign it 0
console.log() //calling the console.log() function
console.log("this", 52) //calling the console.log() function with arguments
let this = console.log("this", 52) //putting it all together

Try to follow the instruction using these examples of syntax as a guide. Please let us know if you have a question (don’t just post code)

What do they mean “assign the value of calling”?

Here I have called the console.log() function with 2 arguments and assigned the result to a variable called this

Does that make it more clear?

So whatever that function returns, will be stored in the this variable.

No, it doesn’t I still don’t understand.

what parts are you having issues with?

Here I’m declaring a variable:

let myVariable;

I don’t have to assign it a value because I’ve used let to declare it.

Here I’m assigning a value to a variable:

const sum = 9;

I do need to assign a value to this variable because I’ve declared it as a const.

Here I am creating a function that takes two parameters (arguments):

function myFunction(param1, param2) {
return param1 + param2;
}

Here I am calling the function I just created and passing it the values for my function’s parameters:

myFunction(8,10);

And here I am assigning the value returned by my function to a variable:

const myVar = myFunction(8,10);

You’ll need to ask a more specific question…

I have been coding in PHP & MySQLi, it was a dangerous game about breeding cats. Guess how I feel right now? The question remains. I still wonder how to finish this exercise.

I feel like an ASP leaf, know this awesome code setInterval 6000