File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
22
33// =============> write your prediction here
4+ // Output: "320" then "The result of multiplying 10 and 32 is undefined"
5+ // Function logs but doesn't return, so template literal receives undefined
46
57function multiply ( a , b ) {
68 console . log ( a * b ) ;
@@ -9,6 +11,11 @@ function multiply(a, b) {
911console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
1012
1113// =============> write your explanation here
14+ // Bug: console.log() prints but doesn't return a value - functions without return give undefined
15+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return
1216
1317// Finally, correct the code to fix the problem
1418// =============> write your new code here
19+ function multiply ( a , b ) {
20+ return a * b ;
21+ }
You can’t perform that action at this time.
0 commit comments