Skip to content

Commit 8e32ef0

Browse files
author
Diana Ausiejute
committed
Fixed formatting
1 parent c7feff6 commit 8e32ef0

14 files changed

Lines changed: 37 additions & 42 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ 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-
9-
// "=" is an assignment operator and so what line 3 is doing, is the new value is being assigned to the variable "count", which in this case is an expression
8+
// "=" is an assignment operator and so what line 3 is doing,
9+
// is the new value is being assigned to the variable "count",
10+
// which in this case is by using an expression

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ const lastName = "Johnson";
77

88
let initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0);
99

10-
11-
1210
// https://www.google.com/search?q=get+first+character+of+string+mdn
1311

14-
console.log(initials);
12+
console.log(initials);

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ const base = filePath.slice(lastSlashIndex + 1);
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-
2120
// https://www.google.com/search?q=slice+mdn
2221

2322
const lastDotIndex = filePath.lastIndexOf(".");
2423
const ext = filePath.slice(lastDotIndex + 1);
25-
26-
24+
//or, const ext = filePath.slice(-3)
2725

2826
//const firstSlashIndex = filePath.indexOf("/");
2927
//const dir = filePath.slice(firstSlashIndex + lastSlashIndex);
@@ -32,6 +30,4 @@ const ext = filePath.slice(lastDotIndex + 1);
3230
//const dir = filePath.slice(0 + (lastSlashIndex - 44));
3331
const dir = filePath.slice(0, lastSlashIndex + 1);
3432

35-
36-
console.log(dir)
37-
33+
console.log(dir);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
88
// It will help to think about the order in which expressions are evaluated
99
// Try logging the value of num and running the program several times to build an idea of what the program is doing
1010

11-
1211
console.log(num);
13-
// This expression uses 2 methods in order to create a random number between (min)1 and (max)100
12+
// This expression uses a function that returns a random number between (min)1 and (max)100.
13+
// So every time I ran the program, it generated a different result (between 1 and 100)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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?
33

4-
// the answer: by using "//" on each line
4+
// the answer: by using "//" on each line

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
// trying to create an age variable and then reassign the value by 1
22

3-
const age = 33;
4-
age = age + 1;
3+
// const age = 33;
4+
// age = age + 1;
5+
6+
// the error is in line 4. It's a "TypeError: Assignment to constant variable", which was thrown because the value to
7+
// a specific constant can only be assigned once (which is done in line 3 already).
8+
// This wouldn't throw an error if instead of const, the let was used
59

6-
// the error is in line 4. It's a "TypeError: Assignment to constant variable", which was thrown because the value to
7-
// a specific constant can only be assigned once (which is done in line 3 already).
8-
// This wouldn't throw an error if instead of const, the let was used
10+
let age = 33;
11+
age = age + 1;
12+
console.log(age);

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

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

4-
console.log(`I was born in ${cityOfBirth}`);
5-
const cityOfBirth = "Bolton";
4+
// console.log(`I was born in ${cityOfBirth}`);
5+
// const cityOfBirth = "Bolton";
66

77
// an error in line 4, "ReferenceError: Cannot access 'cityOfBirth' before initialization", which proves my assumption that
8-
// the value of cityOfBirth should have been assigned prior to trying to print the string
8+
// the value of cityOfBirth should have been assigned prior to trying to print the string
9+
10+
const cityOfBirth = "Bolton";
11+
console.log(`I was born in ${cityOfBirth}`);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ console.log(last4Digits);
1515
// Checked the error reference and decided to look more closely. Noticed that the card number is used as a number,
1616
// so it answers why the function couldn't be called - because they can be only called on Arrays and Strings.
1717
// Therefore, I'll add parentheses to turn the card number into a string (so that the function could be called)
18-

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
const 12HourClockTime = "8:53pm";
2-
const 24hourClockTime = "20:53";
1+
// const 12HourClockTime = "8:53pm";
2+
// const 24hourClockTime = "20:53";
33

4-
console.log(HourClockTime24)
54
// SyntaxError: Invalid or unexpected token.
65
// it turns out that in JS variable names cannot begin with a number
76

87
const HourClockTime12 = "8:53pm";
98
const HourClockTime24 = "20:53";
10-
console.log(HourClockTime24)
9+
console.log(HourClockTime24);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ console.log(`The percentage change is ${percentageChange}`);
2020
// d) Identify all the lines that are variable declarations
2121
// 1, 2
2222
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
23-
// It turns/converts a string into a number by removing the comma and quotation marks (since they are non-number values)
23+
// It turns/converts a string into a number by removing the comma and quotation marks (since they are non-number values)

0 commit comments

Comments
 (0)