Skip to content

Commit 54f45d7

Browse files
committed
fix wrong changes
1 parent 10d77c6 commit 54f45d7

3 files changed

Lines changed: 27 additions & 8 deletions

File tree

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ console.log(`The base part of ${filePath} is ${base}`);
1616

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
19+
const dir = filePath.slice(0, lastSlashIndex);
20+
console.log(`The direction of the file is ${dir}`);
21+
const ext = filePath.slice(filePath.lastIndexOf(".") + 1);
22+
console.log(`The extenction of the file is ${ext}`);
1923

20-
const dir = ;
21-
const ext = ;
22-
23-
// https://www.google.com/search?q=slice+mdn
24+
// https://www.google.com/search?q=slice+mdn

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
const 12HourClockTime = "8:53pm";
2-
const 24hourClockTime = "20:53";
1+
const twelveHourClockTime = "8:53pm";
2+
const twentyFourHourClockTime = "20:53";
3+
// a variable name cannot start with a number and it will cause a SyntaxError

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ let carPrice = "10,000";
22
let priceAfterOneYear = "8,543";
33

44
carPrice = Number(carPrice.replaceAll(",", ""));
5-
priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
5+
priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
66

77
const priceDifference = carPrice - priceAfterOneYear;
88
const percentageChange = (priceDifference / carPrice) * 100;
@@ -11,12 +11,29 @@ console.log(`The percentage change is ${percentageChange}`);
1111

1212
// Read the code and then answer the questions below
1313

14-
// a) How many function calls are there in this file? Write down all the lines where a function call is made
14+
// a) How many function calls are there in this file? Write down all the lines where a function call is made?
15+
//There are 5 function calls:
16+
//replaceAll
17+
//Line 4 and 5
18+
//Number(...)
19+
//Line 4 and 5
20+
//console.log()
21+
//Line 10 ,
1522

1623
// 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?
24+
//error:line 5,SyntaxError: missing ) after argument list,there is a missing comma between the two arguments "," and " "
1725

1826
// c) Identify all the lines that are variable reassignment statements
27+
//carPrice = Number(carPrice.replaceAll(",", ""));
28+
//priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
1929

2030
// d) Identify all the lines that are variable declarations
31+
//let carPrice
32+
//let priceAfterOneYear
33+
//const priceDifference
34+
//const percentageChange
2135

2236
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
37+
//it removes all commas from the string
38+
//converts the string "10000" into the number 10000
39+
//The purpose is to turn the price from a formatted string into a number

0 commit comments

Comments
 (0)