Skip to content

Commit 6a9bf82

Browse files
committed
explain and fix code
1 parent 4919640 commit 6a9bf82

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

  • Sprint-2/2-mandatory-debug

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
3+
// =============explanation==========
4+
// I think will either give error, or no result at all as there is a ";" semicolon after
5+
// the return statement and the actual calculation is not assigned to anything.
46
function sum(a, b) {
57
return;
6-
a + b;
8+
a + b;
79
}
810

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

1113
// =============> write your explanation here
14+
//==============Explanation===============
15+
//To fix the code the ";" must be removed, and the calculation
16+
//needs to be placed next to the "return"
1217
// Finally, correct the code to fix the problem
1318
// =============> write your new code here
19+
function sum(a, b) {
20+
return a + b;
21+
}
22+
23+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)