File tree Expand file tree Collapse file tree
Sprint-2/3-mandatory-interpret Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,16 +22,16 @@ console.log(`The percentage change is ${percentageChange}`);
2222// the error is : a syntax error coming from the missing comma in line 5 between the arguments
2323
2424// c) Identify all the lines that are variable reassignment statements
25- /* const priceDifference = carPrice - priceAfterOneYear; Line 7
26- const percentageChange = (priceDifference / carPrice) * 100 ; Line 8
25+ /* carPrice = Number( carPrice.replaceAll(",", "")); line 4
26+ priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ,"")) ; Line 5
2727*/
2828
2929// d) Identify all the lines that are variable declarations
30- /* carPrice = Number(carPrice.replaceAll(",", "")); Line 4
31- priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); Line 5
30+ /* const carPrice = Number(carPrice.replaceAll(",", "")); Line 7
31+ const percentageChange = (priceDifference / carPrice) * 100; line 8
3232*/
3333
3434// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
35- /* the number function convert the enumerate a string to a number and the method replaceAll replace ever comma with a space
35+ /* the number function convert the enumerate a string to a number and the method replaceAll replace ever comma with empty string
3636 the purpose is to clean the value so that it can be converted to a proper number using Number().
3737 */
You can’t perform that action at this time.
0 commit comments