We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54ca144 commit ff14721Copy full SHA for ff14721
Sprint-2/2-mandatory-debug/1.js
@@ -1,5 +1,6 @@
1
// Predict and explain first...
2
// =============> write your prediction here
3
+// I predict it will show a undefined error
4
5
function sum(a, b) {
6
return;
@@ -9,5 +10,11 @@ function sum(a, b) {
9
10
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
11
12
// =============> write your explanation here
13
+// The problem was the semicolon after return, which made the function stop before adding the numbers
14
// Finally, correct the code to fix the problem
15
// =============> write your new code here
16
+function sum(a, b){
17
+ return a + b; // Once I put a + b on the same line as return, it worked
18
+}
19
+
20
+console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
0 commit comments