Skip to content

Commit a5eef2b

Browse files
committed
fixed errors in code
1 parent bb018c0 commit a5eef2b

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ 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, 49);
20+
const dir = filePath.slice(0, lastSlashIndex);
2121
const ext = filePath.slice(-4);
2222

2323
console.log(`The directory of the file path is ${dir} and the extension is ${ext}`)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
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}`);
54
const cityOfBirth = "Bolton";
5+
console.log(`I was born in ${cityOfBirth}`);
6+
67

7-
It is not working because the const was declared after the console.log
8+
//It is not working because the const was declared after the console.log

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ console.log(`The percentage change is ${percentageChange}`);
1212
// Read the code and then answer the questions below
1313

1414
// a) How many function calls are there in this file? Write down all the lines where a function call is made
15-
line 4 and 5
15+
line 4, 5 and 10
1616

1717
// 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?
1818
The error is coming from line 5, I think it is because there is no comma after the first quotation marks. I can fix
1919
it by adding the comma between the two quotation marks.
2020

2121
// c) Identify all the lines that are variable reassignment statements
22-
line 7 and 8
22+
line 4 and 5
2323

2424
// d) Identify all the lines that are variable declarations
25-
line 1 and 2
25+
line 1, 2, 7 and 8
2626

2727
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
28-
It is removing the commas from the String, making the number easier to read
28+
It removes commas from the string and then converts the cleaned-up string into an actual number, so we can do math with it.

0 commit comments

Comments
 (0)