I don’t understand how to make this function return the sum of two numbers. Can anyone help me with this?
Your code so far
const character = "#";
const count = 8;
const rows = [];
function padRow(name) {
return name;
}
// User Editable Region
function addTwoNumbers() {
return sum
}
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/128.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 55
your function is missing its paramaters. you need two paramaters for the function. and you need to return the sum(adding) of that two paramaters within the function body. you are currently returning the sum variable.
Im sorry I don’t understand, where do I put the parameters? I think in the paranthesis after addTwoNumbers in the function? But i dont know what to make them. Is this closer?
function addTwoNumbers(a, b) {
return sum
}
const sum = a + b;
console.log(sum);