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// =============> write your prediction here
3+ // Prediction: return; exits immediately with undefined, so a + b never runs
4+ // and the message shows "undefined".
35
4- function sum ( a , b ) {
5- return ;
6- a + b ;
7- }
6+ // function sum(a, b) {
7+ // return;
8+ // a + b;
9+ // }
810
9- console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
11+ // console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1012
1113// =============> write your explanation here
14+ // Explanation: A bare return; returns undefined. The expression must be on
15+ // the same return statement: return a + b;
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+
23+ console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
24+
You can’t perform that action at this time.
0 commit comments