File tree Expand file tree Collapse file tree
Sprint-2/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-
5- function multiply ( a , b ) {
4+ //===========Prediction=======
5+ // I think the code will not produce the desired result as the function is not returning any value
6+ /*function multiply(a, b) {
67 console.log(a * b);
78}
8-
99console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
10+ console.log(multiply(3, 5));
11+ typeof(multiply(3, 4));*/
1012
1113// =============> write your explanation here
12-
14+ //===============Explanation=========
15+ // The function itself prints out the result, but the result has no (type) as such and can not be used as
16+ // a data type.
17+ //
1318// Finally, correct the code to fix the problem
19+ //============correction============
20+ // To correct the code "return" needs to be introduced.
1421// =============> write your new code here
22+ function multiply ( a , b ) {
23+ return ( a * b ) ;
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