You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sprint-2/3-mandatory-interpret/1-percentage-change.js
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,3 +20,33 @@ console.log(`The percentage change is ${percentageChange}`);
20
20
// d) Identify all the lines that are variable declarations
21
21
22
22
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
23
+
24
+
//answers
25
+
26
+
/* a) there are there five
27
+
carPrice.replaceAll(",", "")
28
+
Number(carPrice.replaceAll(",", ""))
29
+
Number(priceAfterOneYear.replaceAll(",", ""))
30
+
console.log(...) -
31
+
(priceDifference / carPrice) * 100 - line 7 (this is an expression that involves division and multiplication, but it does not involve a function call)*/
32
+
33
+
34
+
/* b) priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
35
+
The issue is a syntax mistake in the brackets/quotes, and JavaScript throws a SyntaxError before running.
36
+
37
+
the fix would be priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
0 commit comments