Skip to content

Commit 7947510

Browse files
uncomment solution for exercies 1.js
1 parent cf05ff4 commit 7947510

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
// Predict and explain first...
22
// =============> write your prediction here: this code will give an error because the funcion does not return any value and calling it within the consle.log will print undefined.
33

4-
function sum(a, b) {
5-
return;
6-
a + b;
7-
}
4+
// function sum(a, b) {
5+
// return;
6+
// a + b;
7+
// }
88

9-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
9+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1010

1111
// =============> write your explanation here : the sum a+b in line 6 should precede the return statement inorder to return the value.
1212
// Finally, correct the code to fix the problem
1313
// =============> write your new code here
1414

15-
// function sum(a, b) {
16-
// return a + b;
17-
// }
15+
function sum(a, b) {
16+
return a + b;
17+
}
18+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)