Skip to content

Commit f33255c

Browse files
committed
submitted completed task
1 parent e14a4d8 commit f33255c

File tree

1 file changed

+11
-2
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+11
-2
lines changed

Sprint-2/2-mandatory-debug/1.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
3+
// The function is not returning the output of its calculation. Therefore, when we try to log the result of the function call, it will return 'undefined'.
4+
/*
45
function sum(a, b) {
56
return;
67
a + b;
78
}
89
910
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10-
11+
*/
1112
// =============> write your explanation here
13+
// 1- The function 'sum' does not return any value. It only has a return statement without any value, which means it returns 'undefined'.
14+
// 2- When 'sum(10, 32)' is called inside the template literal, it returns 'undefined', so the final output will be "The sum of 10 and 32 is undefined".
15+
1216
// Finally, correct the code to fix the problem
1317
// =============> write your new code here
18+
function sum(a, b) {
19+
return a + b;
20+
}
21+
22+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)