You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The function suppose to return the sum of the two variables but we will encounter an error as the code after return is unreachable.
3
4
4
-
functionsum(a,b){
5
-
return;
6
-
a+b;
7
-
}
8
5
9
-
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
6
+
// function sum(a, b) {
7
+
// return;
8
+
// a + b;
9
+
// }
10
+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10
11
11
12
// =============> write your explanation here
13
+
14
+
// As we return nothing by closing the line with a semicolon hence a + b is not returned where we tell the computer to exit and go back to global scope and the computer will not be able to read the lines after that
15
+
12
16
// Finally, correct the code to fix the problem
13
17
// =============> write your new code here
18
+
19
+
functionsum(a,b){
20
+
returna+b;
21
+
}
22
+
23
+
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
0 commit comments