Skip to content

Commit 0440a7f

Browse files
committed
Fix scope of the function
1 parent b9391ff commit 0440a7f

File tree

1 file changed

+19
-7
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+19
-7
lines changed

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// =============> looking at it I think the sytntaks is worng return; a+b;
3+
4+
// function sum(a, b) {
5+
// return;
6+
// a + b;
7+
// }
8+
9+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10+
11+
// =============>
12+
// I declare in the scope of function what a,b need to do return
13+
// call the function with the template literal
14+
// wich will give me the Text sentence with the result of any sum
15+
16+
// Finally, correct the code to fix the problem
17+
// =============>
318

419
function sum(a, b) {
5-
return;
6-
a + b;
20+
const newSum = a + b;
21+
return newSum;
22+
723
}
824

925
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10-
11-
// =============> write your explanation here
12-
// Finally, correct the code to fix the problem
13-
// =============> write your new code here

0 commit comments

Comments
 (0)