mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-22 11:36:11 -05:00
1.4 KiB
1.4 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 66643c93e05093c728abdbe9 | Step 55 | 1 | step-55 |
--description--
Before moving on, take a moment to review how functions work.
Declare a function named addTwoNumbers. This function should take two arguments and return the sum of those two arguments.
Then declare a sum variable and assign it the value of calling your addTwoNumbers function with 5 and 10 as the arguments. Log the sum variable to the console.
--hints--
You should have a function called addTwoNumbers.
assert.isFunction(addTwoNumbers);
Your function should return the sum of the two numbers.
assert.strictEqual(addTwoNumbers(2,3), 5);
You should declare a sum variable.
assert.isDefined(sum);
You should assign sum the value from calling the addTwoNumbers function with 5 and 10 for the arguments.
assert.strictEqual(sum, 15);
You should log your sum variable.
assert.match(code, /console\.log\(\s*sum\s*\)/);
--seed--
--seed-contents--
const character = "#";
const count = 8;
const rows = [];
function padRow(name) {
return name;
}
--fcc-editable-region--
--fcc-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);