File tree Expand file tree Collapse file tree
Sprint-1/3-mandatory-interpret Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments