Skip to content

Commit 5daf6bf

Browse files
committed
Delete old comments and code
1 parent f267ff6 commit 5daf6bf

8 files changed

Lines changed: 6 additions & 33 deletions

File tree

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,4 @@ const base = filePath.slice(lastSlashIndex + 1);
2121

2222
const lastDotIndex = filePath.lastIndexOf(".");
2323
const ext = filePath.slice(lastDotIndex + 1);
24-
//or, const ext = filePath.slice(-3)
25-
26-
//const firstSlashIndex = filePath.indexOf("/");
27-
//const dir = filePath.slice(firstSlashIndex + lastSlashIndex);
28-
//const dir = filePath.slice(0 + lastSlashIndex);
29-
//const dir = filePath.slice(0 + (lastSlashIndex - 1));
30-
//const dir = filePath.slice(0 + (lastSlashIndex - 44));
3124
const dir = filePath.slice(0, lastSlashIndex);
32-
33-
console.log(dir);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ console.log(num);
1313
// So every time I ran the program, it generated a different result (between 1 and 100).
1414
// Math.random() gives a decimal between 0 < 1. I multiply it by 100 to stretch it out, then Math.floor() chops off the decimals
1515
// to make it a whole number. That gives me 0 to 99.
16-
// The minimum at the end just adds 1 to the whole thing, so now it goes from 1 to 100 instead of 0 to 99
16+
// The minimum at the end just adds 1 to the whole thing, so now it goes from 1 to 100 instead of 0 to 99

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

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

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

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// Currently trying to print the string "I was born in Bolton" but it isn't working...
2-
// what's the error ?
3-
4-
// console.log(`I was born in ${cityOfBirth}`);
5-
// const cityOfBirth = "Bolton";
6-
71
// an error in line 4, "ReferenceError: Cannot access 'cityOfBirth' before initialization", which proves my assumption that
82
// the value of cityOfBirth should have been assigned prior to trying to print the string
93

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +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-
19-
// Fix.
20-

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// const 12HourClockTime = "8:53pm";
2-
// const 24hourClockTime = "20:53";
3-
41
// SyntaxError: Invalid or unexpected token.
52
// it turns out that in JS variable names cannot begin with a number
63

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ console.log(result);
1414
// a) How many variable declarations are there in this program?
1515
// 6
1616
// b) How many function calls are there?
17-
// 5 Fix. 1 (console.log)
17+
// 1 (console.log)
1818
// c) Using documentation, explain what the expression movieLength % 60 represents
1919
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
2020
// The remainder operator calculates the remainder of movie in seconds (it does it by dividing the number by 60)
2121
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22-
// total minutes (in seconds) - remaining seconds = remaining seconds. Then converts the seconds into minutes
23-
// Fix: it removes the leftover seconds that don't form a complete minute before dividing by 60 (conversion to minutes) in order
22+
// it removes the leftover seconds that don't form a complete minute before dividing by 60 (conversion to minutes) in order
2423
// to avoid a messy decimal
2524
// e) What do you think the variable result represents? Can you think of a better name for this variable?
26-
// It represents how much of the movie is left to watch. Maybe something like remainderOfTheMovie
2725
// It represents a total movie length, so could be named totalMovieLength
2826
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
29-
// It won't work with all values. Most importantly, the value must be strictly numeric and positive. Addition: and not messy ()
30-
31-
27+
// It won't work with all values. Most importantly, the value must be strictly numeric and positive.
28+
// Examples: 59 gives 0:0:59, but a clock shows 00:00:59 , -90 gives 0:-1:-30 (time can't be negative),
29+
// 90.5 gives 0:1:30.5 (also doesn't fit the standard time format)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ console.log(`£${pounds}.${pence}`);
2828
// 3-6. const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1);
2929
// : initializes a variable, removes the letter 'p'(it's still a string)
3030
// 8. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
31-
// Here the padstart function turns "399" string into 399 number (it could add some zeroes in front, but here it serves as a converter)
3231
// Correct answer: Ensures the string is at least 3 characters long by adding leading zeros if needed. With "399", it stays "399". But if the input were "5p", this would become "005".
3332
// 9-12. const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2);
3433
// Here the goal is to initialize a variable of Pounds (with the value of 3), by splitting it from 99, and it's done using the substring method

0 commit comments

Comments
 (0)