Skip to content

Commit 7648cf0

Browse files
committed
explained reason for SyntaxError in 1-percentage-change.js
1 parent f2aeade commit 7648cf0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ console.log(`The percentage change is ${percentageChange}`);
1919
// Line 5-
2020
// priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
2121
// ^^^
22-
// SyntaxError: missing ) after argument list
22+
// SyntaxError: missing ) after argument list- The error occurred because there is a missing comma
23+
// The error is a missing comma " , " inside replaceAll( ) and not a closing parenthesis ).
24+
// JavaScript expects two arguments separated by a comma, but there are two strings with no comma between them.
25+
// That makes the parser think the argument list is broken → hence the syntax error.
2326

2427
// c) Identify all the lines that are variable reassignment statements
2528
// carPrice an priceAfterOneYear - lines 4 and 5

0 commit comments

Comments
 (0)