Skip to content

Commit 2276300

Browse files
committed
Improved errors based on feedback
1 parent 19ad2a1 commit 2276300

File tree

13 files changed

+20
-29
lines changed

13 files changed

+20
-29
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ console.log(count);
88
// Describe what line 3 is doing, in particular focus on what = is doing
99

1010
// Line 3 increments the value of the count variable by 1.
11-
// The = operator assigns the result of (count + 1) back to count.
11+
// The = operator assigns the result of (count + 1) back to count.

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ let lastName = "Johnson";
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

88
let initials = firstName[0] + middleName[0] + lastName[0];
9-
console.log(initials);
10-
11-
12-
9+
console.log(initials);
1310

1411
// https://www.google.com/search?q=get+first+character+of+string+mdn
15-
16-

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ console.log(`The base part of ${filePath} is ${base}`);
1818
// Create a variable to store the ext part of the variable
1919

2020
const dir = filePath.slice(0, lastSlashIndex);
21-
const ext = filePath.slice(filePath.lastIndexOf(".")) ;
21+
const ext = filePath.slice(filePath.lastIndexOf("."));
2222

2323
console.log("dir:", dir);
2424
console.log("ext:", ext);
25-
// https://www.google.com/search?q=slice+mdns
25+
// https://www.google.com/search?q=slice+mdns

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ console.log(num);
1515
// Step 1: Math.random() returns a decimal in [0, 1) (includes 0, excludes 1)
1616
// Step 2: Multiply by 100 -> value is in [0, 100)
1717
// Step 3: Math.floor(...) converts it to an integer in [0, 99]
18-
// Step 4: Add 1 -> integer in [1, 100]
18+
// Step 4: Add 1 -> integer in [1, 100]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
let age = 33;
44
age = age + 1;
5-
console.log(age)
5+
console.log(age);

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
2-
// what's the error ? The error was cannot acess 'cityofBirth' before initialization.
3-
// This happpend becouse CityofBirth was declared with a const but was used before its decleration.
2+
// what's the error ? THe error was "Cannot access" 'cityofBirth' before initialization.
3+
// This happened becouse cityofBirth was used before it was declared.
44

55
const cityofBirth = "Bolton";
66
console.log(`I was born in ${cityofBirth}`);
7-
8-

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const cardNumber = 4533787178994213;
22
const last4Digits = cardNumber.toString().slice(-4);
33
console.log(last4Digits);
44

5-
6-
75
// The last4Digits variable should store the last 4 digits of cardNumber
86
// However, the code isn't working
97
// Before running the code, make and explain a prediction about why the code won't work
@@ -13,6 +11,6 @@ console.log(last4Digits);
1311

1412
/*
1513
Prediction: It wont work because cardNumber is a number and slice() only works on strings.
16-
Error: TypeError - cardnumber.slice is not a function.
14+
Error: TypeError - cardnumber.slice is not a function.
1715
Explanation: Numbers dont have the slice method.
18-
*/
16+
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
const hour12HourClockTime = "20:53";
2-
const hour24HourClockTime = "08:53";
2+
const hour24HourClockTime = "08:53";

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ console.log(`The percentage change is ${percentageChange}`);
3030

3131
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
3232
// replaceAll() removes commas and Number() converts the cleaned string into a number.
33-

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ console.log(result);
2626
// Line 4 removes the leftover seconds, then devides by 60.
2727
// then divides the result by 60 to calculate the total full minutes.
2828

29-
// e) What do you think the variable result represents? Can you think of a better name for this variable?
29+
// e) What do you think the variable result represents? Can you think of a better name for this variable?
3030
// Result is a formatted time string in hours, minutes and seconds. A better name for this varible could be formattedTime.
3131

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

0 commit comments

Comments
 (0)