There was an error while loading. Please reload this page.
1 parent 052c090 commit d6eb93eCopy full SHA for d6eb93e
1 file changed
Sprint-3/2-mandatory-debug/1.js
@@ -1,13 +1,21 @@
1
// Predict and explain first...
2
// =============> write your prediction here
3
+ //- return statement in this case stops before it can do the sum of a + b.
4
-function sum(a, b) {
5
- return;
6
- a + b;
7
-}
+// function sum(a, b) {
+// return;
+// a + b;
8
+// }
9
-console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10
+// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
11
12
// =============> write your explanation here
13
+ //- added a + b to return so function returns the sum.
14
// Finally, correct the code to fix the problem
15
// =============> write your new code here
16
+
17
+function sum(a, b) {
18
+ return a + b;
19
+}
20
21
+console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
0 commit comments