I kept notes but cannot figure out how to set up the two number variables that then get added together and returned as the sum. It is helpful having the feedback when you check your answer because the working arguments resolve the feedback. However the direction provided for the rest is not registering with me.
Your code so far
const character = "#";
const count = 8;
const rows = [];
function padRow(name) {
return name;
}
// User Editable Region
function addTwoNumbers() {
}
let sum = (addTwoNumbers);
// 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 Edg/127.0.0.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 55
Not feeling any closer given the feedback when I check my answer. now it doesn’t even recognize my function. It seems like I should have an addition in here to get the numbers added together but we didn’t cover adding numbers in the function, just strings, which we don’t want here. Help?
function addTwoNumbers() {
}
const call = addTwoNumbers(5 + 10);
let sum = (addTwoNumbers);
Your function is empty. There is nothing in the curly { braces }. Look at the example code again.
function sayName(firstName, lastName) {
return "John Doe";
}
This function returns a string.
const call = addTwoNumbers(5 + 10);
Here you create a variable called “call” and assign it the result of the function but the instructions ask you to:
Declare a sum variable
You only pass one argument “5 + 10” but the instructions ask you to pass 2 arguments 5 and 10. Look at the example again.
sayName("Camper", "Cat");
Your final line is still incorrect as I explained before:
The variable name is correct but that’s not how you call a function. You need to review how to use functions. Here’s the syntax of what you need to do, using the example code as boilerplate:
function funcName(parameter1, parameter2) {
return #add the parameters here;
}
let variable = funcName(argument1, argument2);
The boiler plate was the only thing that saved me. I kept careful notes as I’ve gone through the lessons, but just like math class as a kid, you are provided an example problem and solution in class that look nothing like the problem you get for homework. I appreciate your help and I’ll look to reverse engineer the boiler plate example.
The website for JS review is wonderful. Bookmarked. Thank you for that too.
Good syntax examples are sometimes lacking on fCC, I highly recommend doing a quick search for any function or structure that you’re unsure about.
You should always be searching and looking up things, I would say that’s more even valuable than notes. You will never memorize everything and notes take time to write. Everything is already documented well on the Internet and well-explained somewhere. I have certain sites that I find more useful for explanations and examples and you will find one that works best for you.