@@ -7,7 +7,7 @@ priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
77const priceDifference = carPrice - priceAfterOneYear ;
88const percentageChange = ( priceDifference / carPrice ) * 100 ;
99
10- console . log ( `The percentage change is ${ percentageChange } ` ) ;
10+ console . log ( `The percentage change is ${ percentageChange } % ` ) ;
1111
1212// Read the code and then answer the questions below
1313
@@ -38,15 +38,16 @@ console.log(`The percentage change is ${percentageChange}`);
3838
3939// d) Identify all the lines that are variable declarations
4040
41- // These are the lines where variables are first introduced :
41+ // These are the lines that are variables declarations :
4242// let carPrice = "10,000";
4343// let priceAfterOneYear = "8,543";
4444// const priceDifference = carPrice - priceAfterOneYear;
4545// const percentageChange = (priceDifference / carPrice) * 100;
4646
47- // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
47+ // e) Describe what the expression Number(carPrice.replaceAll(",", "")) is doing - what is the purpose of this expression?
4848
4949// carPrice.replaceAll(",", "") - removes all commas from the string "10,000", then it becomes "10000"
5050// Number("10000") - Converts the string "10000" into a numeric value 10000.
51- // Purpose: To convert a formatted currency string (with commas) into a number that can be used for mathematical calculations.
51+ // Purpose: To convert a formatted currency expression (with commas) into a number that is appropriate for mathematical calculations.
52+ //
5253
0 commit comments