Skip to content

Commit b9391ff

Browse files
committed
Add Return to scope of the Function
1 parent 812cf83 commit b9391ff

File tree

1 file changed

+14
-1
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+14
-1
lines changed

Sprint-2/2-mandatory-debug/0.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ function multiply(a, b) {
88

99
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1010

11+
//output= The result of multiplying 10 and 32 is undefined
12+
1113
// =============> write your explanation here
14+
//The function runs console.log(10 * 32) print the result = 320
15+
// after it runs the function dosen't have a return anything ang gives = undefined.
1216

1317
// Finally, correct the code to fix the problem
14-
// =============> write your new code here
18+
// =============> to use the function that gives a result need to use RETURN not consol.log inside the function
19+
20+
function multiply(a, b) {
21+
const forAllMutiply = (a * b);
22+
return forAllMutiply; //return can be use for diferents values/results
23+
}
24+
25+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
26+
27+
//output= The result of multiplying 10 and 32 is 320

0 commit comments

Comments
 (0)