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
// this code will use the declared function multiplay (a, b) to multiply two numbers, 10 and 32, and print the result to the console.
4
+
// However, the function can not be used to get the result because it does not return any value. Instead, it only logs the result to the console.
4
5
5
6
functionmultiply(a,b){
6
7
console.log(a*b);
@@ -9,6 +10,13 @@ function multiply(a, b) {
9
10
console.log(`The result of multiplying 10 and 32 is ${multiply(10,32)}`);
10
11
11
12
// =============> write your explanation here
13
+
// the function does not return any value, it only prints the result to the console, so it can't be used to return anything, it will return "undefined".
12
14
13
15
// Finally, correct the code to fix the problem
14
16
// =============> write your new code here
17
+
18
+
functionmultiply(a,b){
19
+
returna*b;
20
+
}
21
+
22
+
console.log(`The result of multiplying 10 and 32 is ${multiply(10,32)}`);
0 commit comments