Skip to content

Commit 8dab71a

Browse files
committed
Eddit error
1 parent 9493010 commit 8dab71a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 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;
@@ -16,7 +16,6 @@ console.log(`The percentage change is ${percentageChange}`);
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
// Error occurs on line 5 because the second argument to replaceAll is missing quotes.
19-
// Fix: Change `replaceAll("," ""))` to `replaceAll(",", ""))`
2019

2120
// c) Identify all the lines that are variable reassignment statements
2221
// Line 4: carPrice = Number(carPrice.replaceAll(",", ""));

0 commit comments

Comments
 (0)