--description--
We can pass values into a function with arguments. You can use a return
statement to send a value back out of a function.
Example
function plusThree(num) {
return num + 3;
}
const answer = plusThree(5);
answer
has the value 8
.
plusThree
takes an argument for num
and returns a value equal to num + 3
.
--instructions--
Create a function timesFive
that accepts one argument, multiplies it by 5
, and returns the new value.
--hints--
timesFive
should be a function
assert(typeof timesFive === 'function');
timesFive(5)
should return 25
assert(timesFive(5) === 25);
timesFive(2)
should return 10
assert(timesFive(2) === 10);
timesFive(0)
should return 0
assert(timesFive(0) === 0);
--seed--
--seed-contents--
--solutions--
function timesFive(num) {
return num * 5;
}
timesFive(10);