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
Copy file name to clipboardExpand all lines: Sprint-2/2-mandatory-debug/1.js
+16-7Lines changed: 16 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,22 @@
1
1
// Predict and explain first...
2
-
// =============> write your prediction here
2
+
// =============> write your prediction here: js is a sequential language, as in reads code line by line, so i predict nothing will happen after 'return' is processed and
3
+
//some sort of an error message will appear.
4
+
5
+
//function sum(a, b) {
6
+
// return;
7
+
// a + b;
8
+
//}
9
+
10
+
//console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
11
+
12
+
// =============> write your explanation here: 'undefined' error appeared. Fixed the code by adding the addition on the same line as return.
13
+
14
+
15
+
// Finally, correct the code to fix the problem
16
+
// =============> write your new code here:
3
17
4
18
functionsum(a,b){
5
-
return;
6
-
a+b;
19
+
returna+b;
7
20
}
8
21
9
22
console.log(`The sum of 10 and 32 is ${sum(10,32)}`);
0 commit comments