Skip to content

Commit 192c85e

Browse files
committed
Added missing const variable declaration
1 parent 6f122b7 commit 192c85e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@ carPrice = Number(carPrice.replaceAll(",", ""));
2727
priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
2828

2929
// d) Identify all the lines that are variable declarations
30+
3031
let carPrice = "10,000";
3132
let priceAfterOneYear = "8,543";
33+
const priceDifference = carPrice - priceAfterOneYear;
34+
const percentageChange = (priceDifference / carPrice) * 100;
3235

3336

3437
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
3538
replaceAll gets rid of the commas "10,000" becomes "10000".
39+
3640
Number() turns that string into the number 10000.
41+
3742
so we can do maths with it.

0 commit comments

Comments
 (0)