Skip to content

Commit a9900d8

Browse files
authored
Enhance comments for clarity in percentage-change.js
Added comments to explain variable declarations and expressions.
1 parent b70418f commit a9900d8

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,13 @@ 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+
a) There are 5 calls made:
26+
carPrice = Number(carPrice.replaceAll(",", ""));
27+
priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""))
28+
b) Error on line 5 for "," it is missing the seperating , between "," and "".
29+
c) 4 and 5
30+
d) 1 and 2, 7 and 8,
31+
e) It removes the , from the string and replaces it with nothing. Used to help change the string into a number with the "Number" function.
32+
*/

0 commit comments

Comments
 (0)