File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
2- // =============> write your prediction here
2+ // a + b should be written on the same line as return statement
3+ // This function will not return anything because of the semicolon, so when the function is call on line 10 it will be undefined.
34
45function sum ( a , b ) {
56 return ;
@@ -8,6 +9,11 @@ function sum(a, b) {
89
910console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
1011
11- // =============> write your explanation here
12+ // Terminal output "The sum of 10 and 32 is undefined"
13+ // Console.log is calling a function that was not defined because the function body has an incorrect return statement.
14+
1215// Finally, correct the code to fix the problem
13- // =============> write your new code here
16+ function sum ( a , b ) {
17+ return a + b ;
18+ }
19+ console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
You can’t perform that action at this time.
0 commit comments