You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//- "a and b" are defined as parameters and receive 10 and 32. The function calculates and logs 320, but it doesn't return the value. Because there is no return, the function call evaluates to undefined.
4
4
5
-
functionmultiply(a,b){
6
-
console.log(a*b);
7
-
}
5
+
// function multiply(a, b) {
6
+
// console.log(a * b);
7
+
// }
8
8
9
-
console.log(`The result of multiplying 10 and 32 is ${multiply(10,32)}`);
9
+
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
10
10
11
11
// =============> write your explanation here
12
+
//- Added a return statement so the function returns the result to the function call. The console.log() is just printing 320 and function doesn't give 320 back and thats why "${multiply(10, 32)}" gets undefined.
12
13
13
14
// Finally, correct the code to fix the problem
14
15
// =============> write your new code here
16
+
17
+
functionmultiply(a,b){
18
+
returna*b;
19
+
}
20
+
21
+
console.log(`The result of multiplying 10 and 32 is ${multiply(10,32)}`);
0 commit comments