Skip to content

Commit da968b7

Browse files
committed
1.js committed
1 parent 985cde4 commit da968b7

File tree

1 file changed

+15
-1
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
/**
4+
* It returns an "undefined"
5+
*/
36

4-
function sum(a, b) {
7+
/** function sum(a, b) {
58
return;
69
a + b;
710
}
811
912
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
13+
*/
1014

1115
// =============> write your explanation here
16+
/** Explanation:
17+
* The arguments "a + b" should be on the same line as the return so the sum returns that value instead of "undefined"
18+
*/
19+
1220
// Finally, correct the code to fix the problem
1321
// =============> write your new code here
22+
function sum(a, b) {
23+
return a + b;
24+
}
25+
26+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
27+

0 commit comments

Comments
 (0)