Skip to content

Commit c2177db

Browse files
moving return to correct code
1 parent b51c2c4 commit c2177db

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// =============> I think the position of return inside the function is wrong
3+
//probably it is show nothing
34

4-
function sum(a, b) {
5+
/*function sum(a, b) {
56
return;
67
a + b;
78
}
89
9-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); */
1011

1112
// =============> write your explanation here
13+
// After running code it is show "The sum of 10 and 32 is undefined"
14+
// because return has no value so it return undefined.
15+
1216
// Finally, correct the code to fix the problem
1317
// =============> write your new code here
18+
function sum(a, b) {
19+
return a + b;
20+
}
21+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)