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
{{ message }}
Repository navigation
Commit cb0e8e3
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: Sprint-3/2-mandatory-debug/0.js
+13-6Lines changed: 13 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,20 @@
2
2
3
3
// here we are declaring a function called multiply which takes in two arguments and multiplies them but because the function doesn't return the value when we call the function it hasnt been stored anywhere for it to be called upon so i think it will return undefined in the template literal. I also think because there are two console logs one will print the value 320 and the other will print the template literal but as multiply hasn't been stored anywhere it will print 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
-
// =============> write your explanation here
11
+
//320
12
+
//The result of multiplying 10 and 32 is undefined
13
+
// the function as it is only storing the result of a and b in two console logs one asking for the total which is 320 so it prints it and the other is template literal so it prints the template literal but multiply is undefined.
12
14
13
15
// Finally, correct the code to fix the problem
14
-
// =============> write your new code here
16
+
functionmultiply(a,b){
17
+
letmultiplyResult=a*b;
18
+
returnmultiplyResult;
19
+
}
20
+
21
+
console.log(`The result of multiplying 10 and 32 is ${multiply(10,32)}`);
0 commit comments