Skip to content

Commit 2cb48fa

Browse files
author
russom
committed
Format code with prettier
1 parent 23c5495 commit 2cb48fa

11 files changed

Lines changed: 33 additions & 26 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-
// On line 3 is the = sign is an assignment operator and it is assigning thr count + 1 expression into the count variable.
8+
// On line 3 is the = sign is an assignment operator and it is assigning thr count + 1 expression into the count variable.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ const ext = filePath.slice(lastDotIndex + 1);
2424
console.log(`The dir part of ${filePath} is ${dir}`);
2525
console.log(`The ext part of ${filePath} is ${ext}`);
2626

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

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
1212
// num can be any number between minimum 1 and maximum 100.
1313
// 2. The Math.random() method returns a pseudo-random floating number between 0(inclusive) and 1(exclusive).
1414
// 3. The Math.floor() method round a decimal number down to a whole number.
15-
// 4. (maximum - minimum + 1) calculates how many possible whole numbers there are.
16-
// Java Script evaluates the expressions inside the inner parentheses first.
17-
// + minimum adds 1 to move the range from 0 to the minimum 1.
15+
// 4. (maximum - minimum + 1) calculates how many possible whole numbers there are.
16+
// Java Script evaluates the expressions inside the inner parentheses first.
17+
// + minimum adds 1 to move the range from 0 to the minimum 1.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
const cityOfBirth = "Bolton";
55
console.log(`I was born in ${cityOfBirth}`);
66

7-
// Java script cannot access the variable cityOfBirth before initialization.
7+
// Java script cannot access the variable cityOfBirth before initialization.

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

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

1313
// Prediction: slice() is a string method. That is why it is not working on numbers.
1414
// Error message: type error
15-
// Convert the number to string
16-
// If we need to keep number we need to convert it back from string to number using Number() method
15+
// Convert the number to string
16+
// If we need to keep number we need to convert it back from string to number using Number() method

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const twelveHourClockTime = "8:53pm";
22
const twentyFourHourClockTime = "20:53";
33

4-
// Variable names cannot start with a number in Java Script.
4+
// Variable names cannot start with a number in Java Script.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ console.log(`The percentage change is ${percentageChange}`);
3131

3232
// d) Line 1, 2, 7 and 8.
3333

34-
// e) The method replaceALL is removing the comma. Then the Number method is converting the string into numbers.
35-
// The purpose is to use number operations and calculate the percentage change.
34+
// e) The method replaceALL is removing the comma. Then the Number method is converting the string into numbers.
35+
// The purpose is to use number operations and calculate the percentage change.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ console.log(result);
3434

3535
// d) movieLength(8784) - remainingSeconds(24) = 8760(seconds). 8760 / 60 gives us 146 minutes. totalMInutes = 146
3636

37-
// e) result represents the length of the movie in hours, minutes, and seconds format. It can be renamed movieDuration.
37+
// e) result represents the length of the movie in hours, minutes, and seconds format. It can be renamed movieDuration.
3838

39-
// f) When displaying single digit hour, minute, or seconds it doesn't include 0 in front of the digit.
39+
// f) When displaying single digit hour, minute, or seconds it doesn't include 0 in front of the digit.

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
const penceString = "399p";
22

3-
const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1);
3+
const penceStringWithoutTrailingP = penceString.substring(
4+
0,
5+
penceString.length - 1,
6+
);
47

58
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
6-
const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2);
9+
const pounds = paddedPenceNumberString.substring(
10+
0,
11+
paddedPenceNumberString.length - 2,
12+
);
713

8-
const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2);
14+
const pence = paddedPenceNumberString.substring(
15+
paddedPenceNumberString.length - 2,
16+
);
917

1018
console.log(`£${pounds}.${pence}`);
1119

@@ -21,7 +29,7 @@ console.log(`£${pounds}.${pence}`);
2129
// Answers
2230

2331
// 2. const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1):
24-
// the substring() method returns the characters starting at index 0(3) up to and excluding the end(9) of penString variable.
32+
// the substring() method returns the characters starting at index 0(3) up to and excluding the end(9) of penString variable.
2533
// This way only 399 is extracted of the string. Then the result is assigned to penceStringWithoutTrailingP variable.
2634

2735
// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"):
@@ -33,8 +41,8 @@ console.log(`£${pounds}.${pence}`);
3341
// This gives us only the pounds value and it the assigned to the pounds variable.
3442

3543
// 5. const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"):
36-
// substring method first returns the last two characters of the paddedPenceNumberString string.
44+
// substring method first returns the last two characters of the paddedPenceNumberString string.
3745
// Then the padEnd() method adds a 0 if the length of the string is less than 2. Then it assigns it to pence variable.
3846

39-
// 6. console.log(`£${pounds}.${pence}`):
47+
// 6. console.log(`£${pounds}.${pence}`):
4048
// Finally console.log prints the pounds and pence adding the the pound sign £ first using template literal as £3.99

‎Sprint-2/4-stretch-explore/chrome.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Answer
1818

1919
1. 'alert' display a message on pop up window.
2020

21-
2. 'prompt' asks for an input of information.
21+
2. 'prompt' asks for an input of information.
2222

23-
3. 'prompt' return value is string.
23+
3. 'prompt' return value is string.

0 commit comments

Comments
 (0)