@@ -2,7 +2,7 @@ let carPrice = "10,000";
22let priceAfterOneYear = "8,543" ;
33
44carPrice = Number ( carPrice . replaceAll ( "," , "" ) ) ;
5- priceAfterOneYear = Number ( priceAfterOneYear . replaceAll ( "," " ") ) ;
5+ priceAfterOneYear = Number ( priceAfterOneYear . replaceAll ( "," , ", ") ) ;
66
77const priceDifference = carPrice - priceAfterOneYear ;
88const percentageChange = ( priceDifference / carPrice ) * 100 ;
@@ -20,3 +20,21 @@ console.log(`The percentage change is ${percentageChange}`);
2020// d) Identify all the lines that are variable declarations
2121
2222// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
23+
24+
25+ //Responses
26+ //a) function calls are as below:
27+ //carPrice = Number(carPrice.replaceAll(",", ""));
28+ //priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ","));
29+ //b) error = SyntaxError: missing ) after argument list
30+ // (",", ",")); - added , between quoted values
31+ //c) Variable reassignment:
32+ //carPrice = Number(carPrice.replaceAll(",", ""));
33+ //priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ","));
34+
35+ // d) Identify all the lines that are variable declarations
36+ //let carPrice = "10,000";
37+ //let priceAfterOneYear = "8,543";
38+ //const priceDifference = carPrice - priceAfterOneYear;
39+ //const percentageChange = (priceDifference / carPrice) * 100;
40+ // e) cleans the amount format by removing characters such as , and leaving only number
0 commit comments