Skip to content

Commit 39c9dc7

Browse files
clarified and modified some answers for percentage-change file
1 parent b8014c0 commit 39c9dc7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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
*/

0 commit comments

Comments
 (0)