Skip to content

Commit 3ae35f7

Browse files
committed
Updated variable names
1 parent ccf9b9b commit 3ae35f7

File tree

5 files changed

+38
-18
lines changed

5 files changed

+38
-18
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
This is just an instruction for the first activity - but it is just for human consumption
2-
We don't want the computer to run these 2 lines - how can we solve this problem?
1+
// This is just an instruction for the first activity - but it is just for human consumption
2+
// We don't want the computer to run these 2 lines - how can we solve this problem?

Sprint-1/2-mandatory-errors/4.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
const 12HourClockTime = "20:53";
2-
const 24hourClockTime = "08:53";
1+
const twelveHourClockTime = "20:53";
2+
const twentyFourHourClockTime = "08:53";

Sprint-1/3-mandatory-interpret/1-percentage-change.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ let carPrice = "10,000";
22
let priceAfterOneYear = "8,543";
33

44
carPrice = Number(carPrice.replaceAll(",", ""));
5-
priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
5+
priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
66

77
const priceDifference = carPrice - priceAfterOneYear;
88
const percentageChange = (priceDifference / carPrice) * 100;

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
// The return statement is not in the right place, so the function doesn’t return the value.
34

5+
// =============> write your explanation here
6+
// The return statement is stopping the function too early, so it doesn’t return a + b.
7+
8+
// Finally, correct the code to fix the problem
9+
// =============> write your new code here
410
function sum(a, b) {
5-
return;
6-
a + b;
11+
return (a+b);
712
}
813

9-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1014

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

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

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,40 @@
33
// Predict the output of the following code:
44
// =============> Write your prediction here
55

6-
const num = 103;
6+
// const num = 103;
77

8-
function getLastDigit() {
9-
return num.toString().slice(-1);
10-
}
8+
// function getLastDigit() {
9+
// return num.toString().slice(-1);
10+
// }
1111

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)}`);
12+
// console.log(`The last digit of 42 is ${getLastDigit(42)}`);
13+
// console.log(`The last digit of 105 is ${getLastDigit(105)}`);
14+
15+
// console.log(`The last digit of 806 is ${getLastDigit(806)}`);
1516

1617
// Now run the code and compare the output to your prediction
1718
// =============> write the output here
19+
// the last digit of 42 is 3
20+
// the last digit of 105 is 3
21+
// the last digit of 806 is 3
1822
// Explain why the output is the way it is
1923
// =============> write your explanation here
24+
// we will always get number 3 because num is 103 in the last digit of it is 3.
25+
2026
// Finally, correct the code to fix the problem
2127
// =============> write your new code here
28+
const num = 103;
29+
30+
function getLastDigit(num) {
31+
return num.toString().slice(-1);
32+
}
33+
34+
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
35+
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
36+
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
37+
38+
2239

2340
// This program should tell the user the last digit of each number.
2441
// Explain why getLastDigit is not working properly - correct the problem
42+
// We need num in the function as a parameter.

0 commit comments

Comments
 (0)