Skip to content

Commit 5727026

Browse files
committed
missed one function call and added it
1 parent a40c512 commit 5727026

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ console.log(`The percentage change is ${percentageChange}`);
1717
// Line 2: priceAfterOneYear.replaceAll(",", "")
1818
// Line 3: Number(carPrice.replaceAll(",", ""))
1919
// Line 4: Number(priceAfterOneYear.replaceAll(",", ""))
20+
// line 10: console.log(`The percentage change is ${percentageChange}`);
2021

2122
// 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?
2223
// The error is occurring on 4 where we are trying to convert the string values of carPrice and priceAfterOneYear to numbers using the Number function. The error is occurring because the replaceAll method is being called on a string that has not been updated with the new value after the first replaceAll call. To fix this problem, we can update the carPrice and priceAfterOneYear variables with the new values after the replaceAll calls. For example:

0 commit comments

Comments
 (0)