Skip to content

Commit 0f84719

Browse files
committed
deleted the console.log statement from the function and added a return statement
1 parent 69ae220 commit 0f84719

File tree

1 file changed

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

1 file changed

+1
-10
lines changed

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,11 @@ function multiply(a, b) {
99
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1010

1111
// =============> the function multiply has no return statement
12-
12+
// when we call the function multiply(10, 32) it will throw this message: The result of multiplying 10 and 32 is undefined
1313
// Finally, correct the code to fix the problem
1414
// =============>
1515
function multiply(a, b) {
1616
return a * b; // we change the console.log statement with the return statement
1717
}
1818

1919
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
20-
21-
// an extra notice: the purpose of creating a function is to reuse it when needed
22-
// I've noticed that the parameters are already assigned to values 10 and 32, so I changed the code to the following:
23-
function multiply(a, b) {
24-
return console.log(
25-
`The result of multiplying ` + a + ` and ` + b + ` is ` + a * b
26-
);
27-
}
28-
multiply(10, 32);

0 commit comments

Comments
 (0)