Skip to content

Commit bc6f0b8

Browse files
Clarify error explanation in percentage-change exercise
1 parent 555030a commit bc6f0b8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ console.log(`The percentage change is ${percentageChange}`);
1818
// Line 10 calls console.log().
1919

2020
// 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?
21-
// I changed the value from a string to a number by wrapping the replaceAll() result in Number().
21+
// The error was on line 5.
22+
// After using replaceAll(), priceAfterOneYear was still a string instead of a number.
23+
// I fixed it by wrapping the result in Number(), so it was converted to a number before doing the calculation.
2224

2325
// c) Identify all the lines that are variable reassignment statements
2426
// Lines 4 and 5 are variable reassignment statements because its declared on lines 1 and 2.

0 commit comments

Comments
 (0)