Skip to content

Commit bf8a890

Browse files
committed
Fixed syntax error in replaceAll for priceafteroneyear, and answer interpret exercise questions about function calls and variables.
1 parent 4207936 commit bf8a890

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ 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+
// Answer a: 1: carPrice.replaceAll(",", "")- line-4, 2:Number(...)- line-4, 3: priceAfterOneYear.replaceAll(",","")__line-5, 4: Number(...)__line-5, 5: console.log(...)__line-10.
25+
// Answer b: the line 5 has an error, the second replaceAll is missing a comma between the two arguments. to fix this problem add a comma between the two arguments.
26+
// Answer c: line 4 and 5 are variable reassignments.
27+
// Answer d: line 1,2,7 and 8 are variable declarations.
28+
// Answer e: 1: carPrice.replaceAll(",", "")) replaces all commas in "10,000" in an empty string "10000". 2: Number("10000") converts the string "10000" into a number 10000.
29+
// and the purpose of this expression is to clean the price string by removing commas and convert it into a number.

0 commit comments

Comments
 (0)