Skip to content

Commit eb5e0dc

Browse files
committed
The sum function is undefined because the function return was written incorrectly. i explained the error and rewrote the code as a comment.
1 parent 4cdfdd4 commit eb5e0dc

File tree

1 file changed

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

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// =============> write your prediction here: The return function is not defined, so the function will not return the sum of a and b.
33

44
function sum(a, b) {
55
return;
@@ -8,6 +8,9 @@ function sum(a, b) {
88

99
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1010

11-
// =============> write your explanation here
11+
// =============> write your explanation here: in the code above, the function Sum is not returning because the return function is not defined and it is written incorrectly. The return function should be written before the a + b values.//
1212
// Finally, correct the code to fix the problem
1313
// =============> write your new code here
14+
// function sum(a, b) {
15+
// return a + b;
16+
// }

0 commit comments

Comments
 (0)