Skip to content

Commit c37af97

Browse files
Update 1-percentage-change.js
Fix explanation for percentage-change.js syntax error
1 parent 540d4d6 commit c37af97

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ console.log(`The percentage change is ${percentageChange}`);
2727
// Line 10: console.log(...)
2828
//
2929
// b) The error showed up on Line 5. It said "SyntaxError: missing ) after
30-
// argument list". That just means I had one too many closing brackets ( ) )
31-
// at the end of that line.
30+
// argument list". This happened because there was a missing comma between
31+
// the two arguments inside .replaceAll("," "") — JavaScript needs a comma
32+
// separating each argument in a function call. Without it, JavaScript
33+
// couldn't tell where one argument ended and the next began, so it
34+
// reported a missing ), even though the real issue was the missing comma.
3235
//
3336
// c) There are 2 lines where a variable gets a new value (reassignment):
3437
// Line 4: carPrice = ...
@@ -41,4 +44,4 @@ console.log(`The percentage change is ${percentageChange}`);
4144
// First, replaceAll(",", "") takes out all the commas from the text, so
4245
// "10,000" turns into "10000".
4346
// Then, Number(...) changes that text into a real number (10000), so we
44-
// can do maths with it instead of treating it like a word.
47+
// can do maths with it instead of treating it like a word.

0 commit comments

Comments
 (0)