Skip to content

Commit 966c2c2

Browse files
precting, explain and new code
1 parent 3f9d9b6 commit 966c2c2

File tree

1 file changed

+13
-3
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// =============> the function will not perform a + b and will return undefined in the
3+
console.log function
4+
35

46
function sum(a, b) {
57
return;
@@ -8,6 +10,14 @@ function sum(a, b) {
810

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

11-
// =============> write your explanation here
13+
// =============> there shouldn't be a semi-colon after return
14+
// this will signify the end of function so a + b will not be performed therefore there
15+
// is no answer to return to print in the console.log function
16+
1217
// Finally, correct the code to fix the problem
13-
// =============> write your new code here
18+
// =============>
19+
// function sum(a, b) {
20+
// return a + b;
21+
// }
22+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
23+

0 commit comments

Comments
 (0)