Skip to content

Commit 8b3c3ff

Browse files
committed
small mistake with return values not being on the same line
1 parent b06efe8 commit 8b3c3ff

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
// Predict and explain first...
2+
3+
//the function will add the values stored in the parameter.
4+
25
// =============> write your prediction here
36

4-
function sum(a, b) {
5-
return;
6-
a + b;
7-
}
7+
// function sum(a, b) {
8+
// return;
9+
// a + b;
10+
// }
811

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

1114
// =============> write your explanation here
15+
//created a function called sum with two parameters, and from adequate research i have learned that the return and the values have to be on the same line otherwise it tells JavaScript to stop the function at return before reaching a + b.
1216
// Finally, correct the code to fix the problem
1317
// =============> 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)}`);

0 commit comments

Comments
 (0)