Skip to content

Commit c403492

Browse files
committed
Used Prettier to make the code prettier
1 parent fbb60c9 commit c403492

9 files changed

Lines changed: 9 additions & 18 deletions

File tree

‎Sprint-2/1-key-exercises/1-count.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ count = count + 1;
44

55
// Line 1 is a variable declaration, creating the count variable with an initial value of 0
66
// Describe whaWt line 3 is doing, in particular focus on what = we calculate the value of sum operator and put it in left variable.
7-
8-

‎Sprint-2/1-key-exercises/2-initials.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ let initials =
1111

1212
console.log(initials);
1313

14-
1514
// https://www.google.com/search?q=get+first+character+of+string+mdn

‎Sprint-2/1-key-exercises/3-paths.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ console.log(`The direction of the file is ${dir}`);
2121
const ext = filePath.slice(filePath.lastIndexOf(".") + 1);
2222
console.log(`The extenction of the file is ${ext}`);
2323

24-
2524
// https://www.google.com/search?q=slice+mdn

‎Sprint-2/1-key-exercises/4-random.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
55

66
// In this exercise, you will need to work out what num represents?It gives us a random number between 1-100
77
// Try breaking down the expression and using documentation to explain what it means? + minimum shifts it between 1-100 so the minimum number is 1 and the biggest one is 100
8-
//Math.random gives us a random number between 0-1 and the next parantecec returns 100
8+
//Math.random gives us a random number between 0-1 and the next parantecec returns 100
99
//after that we multiple these two given values between 0-100 and the floor methode rounds down the given value and then adding 1(minimum) to the result.
1010
// It will help to think about the order in which expressions are evaluated
1111
// Try logging the value of num and running the program several times to build an idea of what the program is doing

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// the vatriable age was declared as a const variable and trying to assigne another value caused a TypeError: Assignment to constant variable.
33
let age = 33;
44
age = age + 1;
5-
console.log(age)
5+
console.log(age);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const twelveHourClockTime = "8:53pm";
2-
const twentyFourHourClockTime= "20:53";
2+
const twentyFourHourClockTime = "20:53";
33
// a variable name cannot start with a number and it will cause a SyntaxError

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

Lines changed: 2 additions & 3 deletions
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;
@@ -17,7 +17,7 @@ console.log(`The percentage change is ${percentageChange}`);
1717
//Line 4 and 5
1818
//Number(...)
1919
//Line 4 and 5
20-
//console.log()
20+
//console.log()
2121
//Line 10 ,
2222

2323
// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem?
@@ -27,7 +27,6 @@ console.log(`The percentage change is ${percentageChange}`);
2727
//carPrice = Number(carPrice.replaceAll(",", ""));
2828
//priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
2929

30-
3130
// d) Identify all the lines that are variable declarations
3231
//let carPrice
3332
//let priceAfterOneYear

‎Sprint-2/3-mandatory-interpret/2-time-format.js‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ console.log(result);
2525

2626
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?This removes the seconds that don't make up a complete minute.
2727
//Then it divides that number by 60 to convert the seconds into whole minutes.
28-
//we have 8784 seconds so
28+
//we have 8784 seconds so
2929

3030
//8784 - 24 = 8760
3131
//8760 / 60 = 146 it is the total minutes
3232

3333
// e) What do you think the variable result represents? Can you think of a better name for this variable?creates a formatted representation of the movie's length in hours, minutes, and seconds.
3434
//I can name it the movie duration
3535
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
36-
//Works properly for non-negative whole-number seconds; decimals/negative values cause formatting problems
37-
38-
39-
36+
//Works properly for non-negative whole-number seconds; decimals/negative values cause formatting problems

‎Sprint-2/3-mandatory-interpret/3-to-pounds.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ const penceString = "399p";
22

33
const penceStringWithoutTrailingP = penceString.substring(
44
0,
5-
penceString.length - 1
5+
penceString.length - 1,
66
);
77

88
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
99
const pounds = paddedPenceNumberString.substring(
1010
0,
11-
paddedPenceNumberString.length - 2
11+
paddedPenceNumberString.length - 2,
1212
);
1313

1414
const pence = paddedPenceNumberString
@@ -37,4 +37,3 @@ console.log(`£${pounds}.${pence}`);
3737
//Then .padEnd(2, "0") checks the string is at least 2 characters long. If it already has 2 characters, like "99", without changing the rest.
3838
//padEnd(2, "0") adds "0" to the end of the string until it reaches a length of 2.
3939
//finally line 18 combines pound and pence which is £3.99
40-

0 commit comments

Comments
 (0)