Skip to content

Commit 444757f

Browse files
author
russom
committed
Predict, explain, and fix code
1 parent 6018cd5 commit 444757f

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Predict and explain first...
22
// =============> write your prediction here
33

4+
// it will return syntax error
5+
46
function sum(a, b) {
57
return;
68
a + b;
@@ -9,5 +11,16 @@ function sum(a, b) {
911
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1012

1113
// =============> write your explanation here
12-
// Finally, correct the code to fix the problem
14+
15+
// There is a semicolon after return.
16+
17+
// Finally, correct the code to fix the problem.
18+
// Later I discovered having a line between return and a + b gives another undefined error message
1319
// =============> write your new code here
20+
21+
function sum(a, b) {
22+
return a + b;
23+
}
24+
25+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
26+

0 commit comments

Comments
 (0)