Skip to content

Commit df783e8

Browse files
debug2604debug2604
authored andcommitted
Apply Prettier formatting and fix line endings across all files
1 parent b9108fd commit df783e8

13 files changed

Lines changed: 30 additions & 34 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 reassignment of variable "count". The new assignment adds 1 to current value of count, "=" is to assign value on right-hand side to variable on left.
8+
//Line 3 is reassignment of variable "count". The new assignment adds 1 to current value of count, "=" is to assign value on right-hand side to variable on left.

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

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

1112
// 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,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);
20+
const dir = filePath.slice(0, lastSlashIndex);
2121
const ext = filePath.slice(filePath.lastIndexOf("."));
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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
1515
// The method Math.floor() then return greatest integer of the value of this product.
1616
// And finally plus the value of minimum variable declared.
1717

18-
//`num` is a random integer between maximum and minimum inclusive.
18+
//`num` is a random integer between maximum and minimum inclusive.
1919
// The smallest value of 'num' can be 1
2020

21-
22-
console.log(num)
21+
console.log(num);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
let age = 33;
44
age = age + 1;
55

6-
console.log(age)
6+
console.log(age);
77

88
//This is a type error. For the expected result of 34, age should not be declared as a constant.
9-
//let should be used instead of const because const is a constant variable and cannot be reassigned.
9+
//let should be used instead of const because const is a constant variable and cannot be reassigned.

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

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

7-
8-
//The error is that the variable should be declared as a constant before it is used in the console.log statement.
7+
//The error is that the variable should be declared as a constant before it is used in the console.log statement.
98

109
//This is a ReferenceError.
11-
//In this code, the key word does not need to be constant, it can be let - if this is the case the variable city0fBirth can be reassigned in other lines - instead of constant (which cannot reassign variable).
10+
//In this code, the key word does not need to be constant, it can be let - if this is the case the variable city0fBirth can be reassigned in other lines - instead of constant (which cannot reassign variable).

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
// The last4Digits variable should store the last 4 digits of cardNumber
42
// However, the code isn't working
53
// Before running the code, make and explain a prediction about why the code won't work

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// An identifier cannot start with a numberical value
1+
// An identifier cannot start with a numberical value
22

33
const TweleveHourClockTime = "8:53pm";
44
const TwentyFourhourClockTime = "20:53";
55

6-
console.log(TweleveHourClockTime)
7-
console.log(TwentyFourhourClockTime)
6+
console.log(TweleveHourClockTime);
7+
console.log(TwentyFourhourClockTime);

‎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;
@@ -18,7 +18,7 @@ console.log(`The percentage change is ${percentageChange}`);
1818
// 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?
1919
// The error originally came from the replaceAll call for priceAfterOneYear: the two arguments
2020
// (",", "") were missing a comma between them, causing a SyntaxError.
21-
// The fix was adding the missing comma so replaceAll(",", "") has two properly separated arguments.
21+
// The fix was adding the missing comma so replaceAll(",", "") has two properly separated arguments.
2222

2323
// c) Identify all the lines that are variable reassignment statements
2424
// Variable reassignment statements on lines 4 and 5.
@@ -31,4 +31,4 @@ console.log(`The percentage change is ${percentageChange}`);
3131

3232
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
3333
// replaceAll(",", "") removes all comma characters from the string, since commas aren't valid in a numeric value.
34-
// Number() then converts the resulting clean string into an actual number, so it can be used in arithmetic.
34+
// Number() then converts the resulting clean string into an actual number, so it can be used in arithmetic.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ console.log(result);
1313

1414
// a) How many variable declarations are there in this program?
1515
// There are six variable declarations in the program, namely :
16-
// movieLength, remainingSeconds, totalMinutes, remainingMinutes, totalHours, result
16+
// movieLength, remainingSeconds, totalMinutes, remainingMinutes, totalHours, result
1717

1818
// b) How many function calls are there?
1919
// One function call console.log() in code above.
@@ -24,13 +24,13 @@ console.log(result);
2424
// % is remainder operator. This operator returns the remainder after left operand is divided by 60.
2525

2626
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
27-
// The expression means first exclude odd seconds, then convert the movie length in number of complete minutes.
27+
// The expression means first exclude odd seconds, then convert the movie length in number of complete minutes.
2828

2929
// e) What do you think the variable result represents? Can you think of a better name for this variable?
30-
// The variable result represents length of movie in H:M:S format. A better variable name can be movieLength_HMS
30+
// The variable result represents length of movie in H:M:S format. A better variable name can be movieLength_HMS
3131

3232
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
3333
// A value of movieLength 3661 will return a result of 1:1:1 where the place value for second does not conforms with leading zero time format.
34-
//The code does not work for all values:
34+
//The code does not work for all values:
3535
//It does not pad single digits with a leading zero;
36-
//It does not validate to reject negative (e.g.-90 gives "0:-1:-30" ; -90.5 gives "0:-1:-30.5") or decimal input.
36+
//It does not validate to reject negative (e.g.-90 gives "0:-1:-30" ; -90.5 gives "0:-1:-30.5") or decimal input.

0 commit comments

Comments
 (0)