Skip to content

Commit 1125393

Browse files
committed
completed 2-mandatory-debug/1.js
1 parent 4f02ec1 commit 1125393

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

  • Sprint-2/2-mandatory-debug

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
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)}`);
3+
// we have added a semicolon between the return statement and what we want to return, the semicolon signifies the end
4+
// of a statement, so a + b will not be returned
5+
// function sum(a, b) {
6+
// return;
7+
// a + b;
8+
// }
9+
//
10+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1011

1112
// =============> write your explanation here
13+
// I have removed the semicolon right after the return statement
1214
// Finally, correct the code to fix the problem
1315
// =============> write your new code here
16+
function sum(a, b) {
17+
return a + b;
18+
}
19+
20+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)