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
{{ message }}
Repository navigation
Commit 9f6a5e5
Browse filesBrowse the repository at this point in the historyBrowse files
// The return and a + b are on 2 different lines leading to a syntax error. The sum fuctions does not work like this.
4
4
functionsum(a,b){
5
5
return;
6
6
a+b;
@@ -9,5 +9,12 @@ function sum(a, b) {
9
9
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
10
10
11
11
// =============> write your explanation here
12
+
13
+
//The code runs but gives undefined in the console when we call the sum(10, 32). The return function is not defined. We must define it a + b so that when we call it, it give the sum of the 2 values
12
14
// Finally, correct the code to fix the problem
13
15
// =============> write your new code here
16
+
functionsum(a,b){
17
+
returna+b;
18
+
}
19
+
20
+
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
0 commit comments