Skip to content

Commit 0ade9b1

Browse files
author
Payman IB
committed
reverted to original state
1 parent 0da6056 commit 0ade9b1

File tree

3 files changed

+22
-46
lines changed

3 files changed

+22
-46
lines changed

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

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

33
// =============> write your prediction here
4-
// it looks fine.
54

6-
// function multiply(a, b) {
7-
// console.log(a * b);
8-
//}
5+
function multiply(a, b) {
6+
console.log(a * b);
7+
}
98

10-
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
9+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1110

1211
// =============> write your explanation here
13-
// It misses the return value of multiply function.
14-
// Finally, correct the code to fix the problem
15-
// =============> write your new code here
16-
function multiply(a, b) {
17-
return a * b;
18-
}
1912

20-
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
13+
// Finally, correct the code to fix the problem
14+
// =============> write your new code here

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
// there is an error on line 5 and 6
4-
//function sum(a, b) {
5-
// //return;
6-
// a + b;
7-
// }
83

9-
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10-
11-
// =============> write your explanation here
12-
//the return statement is not returning any value. a+b mentioned after return.
13-
// Finally, correct the code to fix the problem
14-
// =============> write your new code here
154
function sum(a, b) {
16-
return a + b;
5+
return;
6+
a + b;
177
}
188

19-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
9+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
10+
11+
// =============> write your explanation here
12+
// Finally, correct the code to fix the problem
13+
// =============> write your new code here

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

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,23 @@
22

33
// Predict the output of the following code:
44
// =============> Write your prediction here
5-
// the result will be 3
6-
// const num = 103;
75

8-
// function getLastDigit() {
9-
// return num.toString().slice(-1);
10-
// }
6+
const num = 103;
117

12-
// console.log(`The last digit of 42 is ${getLastDigit(42)}`);
13-
// console.log(`The last digit of 105 is ${getLastDigit(105)}`);
14-
// console.log(`The last digit of 806 is ${getLastDigit(806)}`);
8+
function getLastDigit() {
9+
return num.toString().slice(-1);
10+
}
11+
12+
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
13+
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
14+
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
1515

1616
// Now run the code and compare the output to your prediction
1717
// =============> write the output here
18-
//The last digit of 42 is 3
19-
// The last digit of 105 is 3
20-
// The last digit of 806 is 3
2118
// Explain why the output is the way it is
2219
// =============> write your explanation here
23-
// because num is defined as 103 and not taking any input from the function parameter.
2420
// Finally, correct the code to fix the problem
2521
// =============> write your new code here
2622

27-
function getLastDigit(num) {
28-
return num.toString().slice(-1);
29-
}
30-
31-
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
32-
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
33-
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
3423
// This program should tell the user the last digit of each number.
35-
// Explain why getLastDigit is not working properly - correct the problem
36-
// because num is defined as 103 and not taking any input from the function parameter.
24+
// Explain why getLastDigit is not working properly - correct the problem

0 commit comments

Comments
 (0)