File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ console.log(`The base part of ${filePath} is ${base}`);
17
17
// Create a variable to store the dir part of the filePath variable
18
18
// Create a variable to store the ext part of the variable
19
19
20
- const dir = filePath . slice ( 0 , 49 ) ;
20
+ const dir = filePath . slice ( 0 , lastSlashIndex ) ;
21
21
const ext = filePath . slice ( - 4 ) ;
22
22
23
23
console . log ( `The directory of the file path is ${ dir } and the extension is ${ ext } ` )
Original file line number Diff line number Diff line change 1
1
// Currently trying to print the string "I was born in Bolton" but it isn't working...
2
2
// what's the error ?
3
3
4
- console . log ( `I was born in ${ cityOfBirth } ` ) ;
5
4
const cityOfBirth = "Bolton" ;
5
+ console . log ( `I was born in ${ cityOfBirth } ` ) ;
6
+
6
7
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
Original file line number Diff line number Diff line change @@ -12,17 +12,17 @@ console.log(`The percentage change is ${percentageChange}`);
12
12
// Read the code and then answer the questions below
13
13
14
14
// 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
16
16
17
17
// 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?
18
18
The error is coming from line 5 , I think it is because there is no comma after the first quotation marks . I can fix
19
19
it by adding the comma between the two quotation marks .
20
20
21
21
// c) Identify all the lines that are variable reassignment statements
22
- line 7 and 8
22
+ line 4 and 5
23
23
24
24
// d) Identify all the lines that are variable declarations
25
- line 1 and 2
25
+ line 1 , 2 , 7 and 8
26
26
27
27
// 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 .
You can’t perform that action at this time.
0 commit comments