File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
2- // =============> write your prediction here
2+ // =============> the return statement is placed before the actual sum,
3+ // which means that the function will return undefined before it can calculate the sum of a and b.
4+ // Therefore, the output will be "The sum of 10 and 32 is 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
11- // =============> write your explanation here
13+ // =============> The program behaved as predicted
1214// Finally, correct the code to fix the problem
1315// =============> write your new code here
16+
17+ function sum ( a , b ) {
18+ add = a + b ;
19+ return add ;
20+ }
21+
22+ console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
Original file line number Diff line number Diff line change 11// Predict and explain first...
22
33// Predict the output of the following code:
4- // =============> Write your prediction here
4+ // =============>
55
66const num = 103 ;
77
You can’t perform that action at this time.
0 commit comments