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
// =============> write your prediction here: this code will give an error because the funcion does not return any value and calling it within the consle.log will print undefined.
3
3
4
-
functionsum(a,b){
5
-
return;
6
-
a+b;
7
-
}
4
+
// function sum(a, b) {
5
+
// return;
6
+
// a + b;
7
+
// }
8
8
9
-
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
9
+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10
10
11
11
// =============> write your explanation here : the sum a+b in line 6 should precede the return statement inorder to return the value.
12
12
// Finally, correct the code to fix the problem
13
13
// =============> write your new code here
14
14
15
-
// function sum(a, b) {
16
-
// return a + b;
17
-
// }
15
+
functionsum(a,b){
16
+
returna+b;
17
+
}
18
+
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
0 commit comments