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 da1d102
Browse filesBrowse the repository at this point in the historyBrowse files
// =============> This will not work because the a + b statement should have been after return, but return has a semicolon after it which stops the function an returns nothing
3
3
4
4
functionsum(a,b){
5
5
return;
@@ -8,6 +8,12 @@ function sum(a, b) {
8
8
9
9
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
10
10
11
-
// =============> write your explanation here
11
+
// =============> Because return and a+b are not on the same line, the line after return is never reached, and would be considered dead code and therefore the console logs argument as undefined
12
+
12
13
// Finally, correct the code to fix the problem
13
-
// =============> write your new code here
14
+
15
+
functionsum(a,b){
16
+
returna+b;
17
+
}
18
+
19
+
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
0 commit comments