@@ -2,12 +2,12 @@ let carPrice = "10,000";
22let priceAfterOneYear = "8,543" ;
33
44carPrice = Number ( carPrice . replaceAll ( "," , "" ) ) ;
5- priceAfterOneYear = Number ( priceAfterOneYear . replaceAll ( "," "" ) ) ;
5+ priceAfterOneYear = Number ( priceAfterOneYear . replaceAll ( "," , "" ) ) ;
66
7- const PriceDifference = carPrice - priceAfterOneYear ;
8- const PercentageChange = ( PriceDifference / carPrice ) * 100 ;
7+ const priceDifference = carPrice - priceAfterOneYear ;
8+ const 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
@@ -23,8 +23,8 @@ Number(priceAfterOneYear.replaceAll(",", ""))
2323// the error is comin from this line
2424
2525priceAfterOneYear = Number ( priceAfterOneYear . replaceAll ( "," "" ) ) ;
26- // the error happens becuae there is missing comma inside reaplaceAll() .
27- //The correct line should be
26+ // The error happens because a comma is missing between the arguments in the replaceAll() function .
27+ // The correct line should be
2828priceAfterOneYear = Number ( priceAfterOneYear . replaceAll ( "," , "" ) ) ;
2929
3030// c) Identify all the lines that are variable reassignment statements
0 commit comments