Skip to content

Commit f4c8a01

Browse files
committed
completed 1-percentage-change.js
1 parent 5e2f25a commit f4c8a01

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ console.log(`The percentage change is ${percentageChange}`);
1212
// Read the code and then answer the questions below
1313

1414
// a) How many function calls are there in this file? Write down all the lines where a function call is made
15-
15+
// there are three function calls on lines 4, 5, and 8.
1616
// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem?
17-
17+
// the error is on line 5. There needs to be a comma after the quotation marks to make it a correct Javascript syntax.
1818
// c) Identify all the lines that are variable reassignment statements
19-
19+
// lines 4 and 5.
2020
// d) Identify all the lines that are variable declarations
21-
21+
// lines 1, 2, 6, and 7.
2222
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
23+
// it is removing the commas so that it has a numeric value as opposed to a formatted string. This allows for calculations by making the string convertible to numbers. The replaceAll() removes all commas, and the Number() makes the result a numeric value.

0 commit comments

Comments
 (0)