Skip to content

Commit df8c275

Browse files
committed
Undo changes in sprint2
This reverts commit 6f122b7.
1 parent 59316af commit df8c275

File tree

6 files changed

+3
-59
lines changed

6 files changed

+3
-59
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function capitalise(str) {
99
return str;
1010
}
1111

12+
1213
// =============> write your explanation here
1314
// =============> write your new code here
1415

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function convertToPercentage(decimalNumber) {
1111

1212
return percentage;=
1313
}
14+
1415
console.log(decimalNumber);
1516

1617
// =============> write your explanation here

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function square(3) {
99

1010
return num * num;
1111
}
12+
1213
// =============> write the error message here
1314

1415
SyntaxError: Unexpected number

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,5 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1010

1111
// =============> write your explanation here
1212

13-
the function just prints the answer, it dont return it.
14-
15-
so when we try to use it inside the message it shows undefined.
16-
1713
// Finally, correct the code to fix the problem
1814
// =============> write your new code here
19-
20-
function multiply(a, b){
21-
22-
return a * b
23-
}
24-
25-
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`)
26-

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,5 @@ function sum(a, b) {
99
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1010

1111
// =============> write your explanation here
12-
13-
the code dont work cuz the return stops the code before it adds the numbers.
14-
15-
so js never does a + b, that’s why it show undefined.
16-
1712
// Finally, correct the code to fix the problem
1813
// =============> write your new code here
19-
20-
function sum(a, b){
21-
22-
return a + b
23-
}
24-
25-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`)
26-

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

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

3-
it will print 3 for all of them
4-
53
// Predict the output of the following code:
6-
7-
The last digit of 42 is 3
8-
The last digit of 105 is 3
9-
The last digit of 806 is 3
10-
114
// =============> Write your prediction here
125

136
const num = 103;
147

158
function getLastDigit() {
16-
179
return num.toString().slice(-1);
1810
}
1911

@@ -23,35 +15,9 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`);
2315

2416
// Now run the code and compare the output to your prediction
2517
// =============> write the output here
26-
27-
The last digit of 42 is 2
28-
29-
The last digit of 105 is 5
30-
31-
The last digit of 806 is 6
32-
3318
// Explain why the output is the way it is
3419
// =============> write your explanation here
35-
36-
It always shows 3 cuz the function just uses the num at the top (103).
37-
38-
It ignores the numbers we put in () like 42, 105, 806.
39-
40-
We need to let the function take a number as input.
41-
4220
// Finally, correct the code to fix the problem
43-
44-
function getLastDigit(num){
45-
46-
return num.toString().slice(-1)
47-
}
48-
49-
console.log(The last digit of 42 is ${getLastDigit(42)})
50-
51-
console.log(The last digit of 105 is ${getLastDigit(105)})
52-
53-
console.log(The last digit of 806 is ${getLastDigit(806)})
54-
5521
// =============> write your new code here
5622

5723
// This program should tell the user the last digit of each number.

0 commit comments

Comments
 (0)