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 8b9263a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: Sprint-3/2-mandatory-debug/1.js
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,17 @@
1
1
// Predict and explain first...
2
-
// =============> write your prediction here
2
+
// By using the semi-colon after the return, this is closing off the function and leaving the parameters as undefined, causing the console.log state that the parameters are undefined.
3
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
+
// by using the semi-colon after the return, and having the parameters put into a separate line, the return can't define the parameters of the function.
12
+
// Finally, correct the code to fix the problem
4
13
functionsum(a,b){
5
-
return;
6
-
a+b;
14
+
returna+b;
7
15
}
8
16
9
17
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
0 commit comments