Skip to content

Commit 8f31dc9

Browse files
formatted the files using prettier
1 parent cd39a5a commit 8f31dc9

10 files changed

Lines changed: 22 additions & 24 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ count = count + 1;
55
// Line 1 is a variable declaration, creating the count variable with an initial value of 0
66
// Describe what line 3 is doing, in particular focus on what = is doing
77

8-
// Line 3 is an increment where = is an assignment operator and in there we are adding value of 1 to the count variable
8+
// Line 3 is an increment where = is an assignment operator and in there we are adding value of 1 to the count variable

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const lastName = "Johnson";
55
// Declare a variable called initials that stores the first character of each string.
66
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
77

8-
const initials = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}`;
8+
const initials = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}`;
99

10-
console.log(initials)
10+
console.log(initials);
1111
// https://www.google.com/search?q=get+first+character+of+string+mdn

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ console.log(`The base part of ${filePath} is ${base}`);
1717
// Create a variable to store the dir part of the filePath variable
1818
// Create a variable to store the ext part of the variable
1919

20-
const dir = filePath.slice(0, lastSlashIndex);
20+
const dir = filePath.slice(0, lastSlashIndex);
2121
const ext = filePath.slice(filePath.lastIndexOf("."));
2222

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

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
1010

1111
// math.floor round down to the nearest whole number e.g Math.floor(4.4) or Math.floor(4.8) will return 4
1212
// math.ceil round up to the nearest whole number e.g Math.ceil(4.8) and Math.ceil(4.4) will return 5
13-
// (maximum - minimum + 1) provide a range of generated random number
13+
// (maximum - minimum + 1) provide a range of generated random number
1414
// num is a random whole number [1,100]
1515

16-
console.log(Math.floor(4.8))
17-
console.log(Math.floor(4.4))
18-
console.log(Math.ceil(4.8))
19-
console.log(Math.ceil(4.4))
16+
console.log(Math.floor(4.8));
17+
console.log(Math.floor(4.4));
18+
console.log(Math.ceil(4.8));
19+
console.log(Math.ceil(4.4));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// 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?
2+
// We don't want the computer to run these 2 lines - how can we solve this problem?

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
22
// what's the error ?
33

4-
54
const cityOfBirth = "Bolton";
65
console.log(`I was born in ${cityOfBirth}`);
76

8-
// the error is that cityOfBirth varaible declared after the logging command
7+
// the error is that cityOfBirth variable declared after the logging command

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ const cardNumber = 4533787178994213;
1010

1111
// I predicted the last four digits bit it has to be a string in order to use the method slice and that explain why it wasn't working
1212
const last4Digits = cardNumber.toString().slice(-4);
13-
console.log(last4Digits)
13+
console.log(last4Digits);

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

Lines changed: 3 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;
@@ -19,7 +19,7 @@ console.log(`The percentage change is ${percentageChange}`);
1919
//5-console.log(..) - line 9
2020

2121
// 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?
22-
// the error is : a syntax error coming from the missing comma in line 5 between the arguments
22+
// the error is : a syntax error coming from the missing comma in line 5 between the arguments
2323

2424
// c) Identify all the lines that are variable reassignment statements
2525
/* carPrice = Number(carPrice.replaceAll(",", "")); line 4
@@ -37,4 +37,4 @@ const percentageChange = (priceDifference / carPrice) * 100; line ==> 8
3737
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
3838
/* the number function convert the enumerate a string to a number and the method replaceAll replace ever comma with empty string
3939
the purpose is to clean the value so that it can be converted to a proper number using Number().
40-
*/
40+
*/

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ console.log(result);
2828
// e) What do you think the variable result represents? Can you think of a better name for this variable?
2929
//A--> results present length of movie formatted as Hours:Minutes:Seconds and a better name could be fromatedMovieDuration
3030

31-
3231
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
3332
/*whole positive value: for the 8784 seconds the formatted duration would be fine 2:26:24 and the code would be working as expected
3433
under 60 seconds: 59 seconds would assign the hours and minutes both as 0s resulting 0:0:59 instead of the normal formatted way 00:00:59 but still correct

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

Lines changed: 6 additions & 6 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
@@ -26,8 +26,8 @@ console.log(`£${pounds}.${pence}`);
2626
// To begin, we can start with
2727
// 1. const penceString = "399p": initialises a string variable with the value "399p"
2828

29-
// 2. const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1); reassigned a new value
30-
// using the method substring starting form the index 0 ="3" and ending with -1 exclusively meaning doesn't include 'p'
29+
// 2. const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1); reassigned a new value
30+
// using the method substring starting form the index 0 ="3" and ending with -1 exclusively meaning doesn't include 'p'
3131
// resulting with a numeric part of the price which is '399'
3232

3333
//3.const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
@@ -37,8 +37,8 @@ console.log(`£${pounds}.${pence}`);
3737
//extracts everything except the last two number to form the pound portion of the price
3838

3939
//5.const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0");
40-
//extracts the last two digits to form the pence portion of the price and the padEnd method ensure the number in a two digits format consistent
40+
//extracts the last two digits to form the pence portion of the price and the padEnd method ensure the number in a two digits format consistent
4141

4242
//6.console.log(`£${pounds}.${pence}`);
4343
//Combines everything into the final formatted price string. Result: £3.99
44-
//basically the program will take the string "399p" and print out a string of "£3.99"
44+
//basically the program will take the string "399p" and print out a string of "£3.99"

0 commit comments

Comments
 (0)