Skip to content

Commit 9bfd01a

Browse files
removed the semicolon after the "return" and moved "a+b" on the same line with"return" otherwise a semicolon would be automatically inserted
1 parent f7173fc commit 9bfd01a

File tree

1 file changed

+12
-7
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// SyntaxError
33

4+
// function sum(a, b) {
5+
// return;
6+
// a + b;
7+
// }
8+
9+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10+
11+
// the function doesn't return anything because there is ";" immediately after "return" and the mathematicall operation is on another line
12+
// Finally, correct the code to fix the problem
413
function sum(a, b) {
5-
return;
6-
a + b;
14+
return a + b;
15+
716
}
817

918
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10-
11-
// =============> write your explanation here
12-
// Finally, correct the code to fix the problem
13-
// =============> write your new code here

0 commit comments

Comments
 (0)