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// =============> write your prediction here
3+ //I think this code will not give correct output, it will give undefined.
34
4- function sum ( a , b ) {
5+ /* function sum(a, b) {
56 return;
67 a + b;
78}
89
9- console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
10+ console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);*/
1011
1112// =============> write your explanation here
13+ /*This code will print undefined because return; stops the function immediately.
14+ The line a + b is never executed, so the function returns undefined and the template
15+ string receives undefined instead of the sum.*/
16+
1217// Finally, correct the code to fix the problem
1318// =============> write your new code here
19+ function sum ( a , b ) {
20+ return a + b ;
21+ }
22+ console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
You can’t perform that action at this time.
0 commit comments