File tree Expand file tree Collapse file tree
Sprint-3/2-mandatory-debug Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Predict and explain first...
22
33// =============> write your prediction here
4+ // The output will be:
5+ // 320
6+ // The result of multiplying 10 and 32 is undefined
47
58function multiply ( a , b ) {
69 console . log ( a * b ) ;
@@ -9,6 +12,14 @@ function multiply(a, b) {
912console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
1013
1114// =============> write your explanation here
15+ // multiply(10, 32) runs the function and console.log(a * b) prints 320.
16+ // However, the function does not have a return statement.
17+ // A JavaScript function without a return statement returns undefined.
1218
1319// Finally, correct the code to fix the problem
1420// =============> write your new code here
21+ function multiply ( a , b ) {
22+ return a * b ;
23+ }
24+
25+ console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
You can’t perform that action at this time.
0 commit comments