Skip to content

Commit f32ded2

Browse files
Fix Sprint 1 reviewer feedback
1 parent bc6f0b8 commit f32ded2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ 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-
// 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.
21+
// The error occurs on line 5.
22+
// The replaceAll() function call is missing a comma between its two arguments.
23+
// Because the function call is not valid JavaScript syntax, JavaScript throws a SyntaxError and cannot run the code.
24+
// I fixed it by adding the missing comma:
2425

26+
// priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
2527
// c) Identify all the lines that are variable reassignment statements
2628
// Lines 4 and 5 are variable reassignment statements because its declared on lines 1 and 2.
2729

0 commit comments

Comments
 (0)