Skip to content

Commit a16ebf1

Browse files
committed
corrected variable declarations & reassignment
1 parent 84b90f5 commit a16ebf1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ console.log(`The percentage change is ${percentageChange}`);
2525

2626
// c) Identify all the lines that are variable reassignment statements
2727
// There are 2 variable reassignment statements.
28-
// const priceDifference = carPrice - priceAfterOneYear;
29-
// const percentageChange = (priceDifference / carPrice) * 100;
28+
// carPrice = Number(carPrice.replaceAll(",", ""));
29+
// priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
3030

3131
// d) Identify all the lines that are variable declarations
3232
// There are 4 variable declarations lines.
3333
// let carPrice = "10,000";
3434
// let priceAfterOneYear = "8,543";
35+
// const priceDifference = carPrice - priceAfterOneYear;
36+
// const percentageChange = (priceDifference / carPrice) * 100;
3537

3638
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
3739
// Firstly this expression replace all the commas from the variable carPrice = "10,000" to "10000" and then it converts

0 commit comments

Comments
 (0)