Challenge: Create a Sum Function
Task
Implement a function sum
that takes three arguments (a
, b
, and c
) and returns their sum.
Next, call this function twice, using the following sets of arguments:
- Use
24
,12
, and32
for the first function call and store the result in the variablesum1
. - Use
12
,42
, and5
for the second function call and store the result in the variablesum2
.
Finally, print the results of both function calls.
function sum(___, ___, ___) { ___ a + b + c; }; let sum1 = ___(___, ___, ___); let sum2 = ___(___, ___, ___); console.log("sum1 =", ___); console.log("sum2 =", ___);
The output should be:
pythonsum1 = 68sum2 = 59
¡Gracias por tus comentarios!