File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
22// =============> write your prediction here
33
4+ // I predict that the code will output 'undefined' because the function sum does not return any value.
5+
6+ // this function should sum two numbers and return the result
7+
48function sum ( a , b ) {
5- return ;
6- a + b ;
9+ return a + b ;
710}
811
912console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
1013
1114// =============> write your explanation here
15+
16+
17+ // The function sum correctly returns the sum of the two numbers, so the template literal will output the correct result.
18+
1219// Finally, correct the code to fix the problem
1320// =============> write your new code here
21+
22+ function sum ( a , b ) {
23+ return a + b ;
24+ }
25+ console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ; // No change needed as the code is already correct
You can’t perform that action at this time.
0 commit comments