File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
22
3- // =============> write your prediction here
3+ // =============> console.log(a*b) is inside the function, so it does not return anything instead return undefined by default
44
55function multiply ( a , b ) {
66 console . log ( a * b ) ;
77}
88
99console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
1010
11- // =============> write your explanation here
11+ // =============> When we call multiply(10, 32) inside the template string, it first runs console.log(320) inside the function.
12+ // Then it tries to insert the function’s return value (which is undefined) into the string.
13+ // So, we’ll see:csharp
14+ // Copy
15+ // Edit
16+ // 320
17+ // The result of multiplying 10 and 32 is undefined
1218
1319// Finally, correct the code to fix the problem
14- // =============> write your new code here
20+ // =============> my new code:
21+ function multiply ( a , b ) { return ( a * b ) } ;
22+
23+ 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