Skip to content

Commit 496ec07

Browse files
committed
refactor: remove commented-out code and improve clarity in key error examples
1 parent c26d1a3 commit 496ec07

File tree

3 files changed

+5
-23
lines changed

3 files changed

+5
-23
lines changed

Sprint-2/1-key-errors/2.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ function square(3) {
1515

1616
// Finally, correct the code to fix the problem
1717

18-
// =============> write your new code here
19-
18+
// =============> write your new code here

Sprint-2/2-mandatory-debug/0.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
// Predict and explain first...
22

33
// =============> write your prediction here
4-
// The function is not returning the output of its calculation. Therefore, when we try to log the result of the function call, it will return 'undefined'.
5-
/*
4+
65
function multiply(a, b) {
76
console.log(a * b);
87
}
98

109
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
11-
*/
10+
1211
// =============> write your explanation here
13-
// 1- The function 'multiply' does not return any value. It only logs the result to the console.
14-
// 2- When 'multiply(10, 32)' is called inside the template literal, it returns 'undefined', so the final output will be "The result of multiplying 10 and 32 is undefined".
1512

1613
// Finally, correct the code to fix the problem
1714
// =============> write your new code here
18-
function multiply(a, b) {
19-
return a * b;
20-
}
21-
22-
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

Sprint-2/2-mandatory-debug/1.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
// The function is not returning the output of its calculation. Therefore, when we try to log the result of the function call, it will return 'undefined'.
4-
/*
3+
54
function sum(a, b) {
65
return;
76
a + b;
87
}
98

109
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
11-
*/
12-
// =============> write your explanation here
13-
// 1- The function 'sum' does not return any value. It only has a return statement without any value, which means it returns 'undefined'.
14-
// 2- When 'sum(10, 32)' is called inside the template literal, it returns 'undefined', so the final output will be "The sum of 10 and 32 is undefined".
1510

11+
// =============> write your explanation here
1612
// Finally, correct the code to fix the problem
1713
// =============> write your new code here
18-
function sum(a, b) {
19-
return a + b;
20-
}
21-
22-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)