Skip to content

Commit c806b08

Browse files
committed
prettier used on sprint-2
1 parent 5196ca3 commit c806b08

13 files changed

Lines changed: 21 additions & 26 deletions

File tree

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

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

55
// = is an assign operator so if count = 0 at line 1 then at line 3 count = 0 + 1
66

7-
87
// Line 1 is a variable declaration, creating the count variable with an initial value of 0
98
// Describe what line 3 is doing, in particular focus on what = is doing

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ 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 =
9-
firstName.charAt(0)
10-
middleName.charAt(0)
8+
const initials = firstName.charAt(0);
9+
middleName.charAt(0);
1110
lastName.charAt(0);
1211

1312
console.log(initials);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ 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) ;
21-
const ext = filePath.slice(-4) ;
20+
const dir = filePath.slice(0, lastSlashIndex);
21+
const ext = filePath.slice(-4);
2222

2323
console.log(dir);
2424
console.log(ext);
2525

26-
// https://www.google.com/search?q=slice+mdn
26+
// 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
@@ -3,7 +3,7 @@ const maximum = 100;
33

44
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
55
//Math.floor is rounding down number from float number to integer
6-
//Math.random create a random decimal number(float) from 0 up to 1 we then multiply it by (100) and add 1(minimum)
6+
//Math.random create a random decimal number(float) from 0 up to 1 we then multiply it by (100) and add 1(minimum)
77
// variable num represents a random integer ranging from 1 to 100
88
console.log(num);
99

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
const age = 33;
44
age = age + 1;
55
/* const means that the variable cannot be reassigned we should use let keyword instead.
6-
TypeError displayed due to that. */
6+
TypeError displayed due to that. */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ const cityOfBirth = "Bolton";
77
//The error we see it's a ReferenceError which tells us that we cannot access variable before initialization.
88

99
/*JavaScript reads the code from top to bottom, order is wrong.
10-
Task cannot be executed as variable cannot be access before being created. */
10+
Task cannot be executed as variable cannot be access before being created. */

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ console.log(last4Digits);
99
// Consider: Why does it give this error? Is this what I predicted? If not, what's different?
1010
// Then try updating the expression last4Digits is assigned to, in order to get the correct value
1111

12-
1312
/*The code would not work because cardNumber variable stores number data type and .slice() method cannot be used on a number,
1413
if we run the code without changing data type to string we will get TypeError displayed
15-
I used .toString() method to convert cardNumber variable to a string and then used .slice(-4) to get the last 4 digits. */
14+
I used .toString() method to convert cardNumber variable to a string and then used .slice(-4) to get the last 4 digits. */

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

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

2424
//a)There are 5 function calls on line 4, 5 and 10.
2525
//b) error is coming from line 5, there is missing , between arguments in replaceAll method
26-
//c) line 4 and 5
26+
//c) line 4 and 5
2727
//d) line 1,2 and 7,8
2828
/*e) replaceAll method inside of () replace comma with nothing, removing it from the string,
29-
then Number converts string to number data type */
29+
then Number converts string to number data type */

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ console.log(result);
2424

2525
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
2626

27-
2827
//a) There are 6 variable declarations.
2928
//b)There is 1 function call on line 10
3029
//c) movieLength use remainder operator % . movieLength % 60 returns the remaining seconds after dividing the movie length into full minutes.
3130
//d) expression assigned to totalMinutes calculate movie time in whole minutes.
3231
//e) This variable represent total movie time in hh/mm/ss format, we could name it totalTime or totalMovieTime.
33-
//f) Yes, the code works correctly when movieLength is non-negative whole number that represents seconds.
32+
//f) Yes, the code works correctly when movieLength is non-negative whole number that represents seconds.

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

Lines changed: 4 additions & 4 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,7 +26,7 @@ console.log(`£${pounds}.${pence}`);
2626
// To begin, we can start with
2727

2828
// 1. const penceString = "399p": initialises a string variable with the value "399p"
29-
// 3. penceStringWithoutTrailingP is created using substring() on penceString. The purpose is to remove the trailing "p"..
29+
// 3. penceStringWithoutTrailingP is created using substring() on penceString. The purpose is to remove the trailing "p"..
3030
// 4. value for substring method to start from which is beginning of the string.
3131
// 5. penceString variable uses argument of .length to -1 (p) from the value, 399p becomes 399.
3232
// 6. substring method closure
@@ -35,7 +35,7 @@ console.log(`£${pounds}.${pence}`);
3535
//10. value for substring method which is beginning of the string.
3636
//11. paddedPenceNumberString variable is using length argument and deduct 2 out of length of the string 399 become 3 as pounds.
3737
//12. Closes the substring method.
38-
//14. pence variable created from paddedPenceNumberString
38+
//14. pence variable created from paddedPenceNumberString
3939
//15. substring method called which value of is in the parenthesis (variable length -2 characters)
4040
//16. method padEnd is called that contains at least 2 character and adds 0 at the end if needed.
4141
//18. we log £3.99 in the console.

0 commit comments

Comments
 (0)