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
@@ -20,3 +20,19 @@ 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
+
// Answer
25
+
// a) Line 4: Number(carPrice.replaceAll(",", "")); and carPrice.replaceAll(",", "")
26
+
// a) Line 5: Number(priceAfterOneYear.replaceAll("," "")); and priceAfterOneYear.replaceAll("," "")
27
+
28
+
// b) The error is coming from line 5. The error is occurring in the replaceAll method a comma is missing between ("," "") it should be (",", "") to fix the problem.
29
+
30
+
// c) line 4: carPrice = Number(carPrice.replaceAll(",", ""));
31
+
// c) line 5: priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
32
+
33
+
// d) Line 1: let carPrice = "10,000";
34
+
// d) Line 2: let priceAfterOneYear = "8,543";
35
+
// d) Line 7: const priceDifference = carPrice - priceAfterOneYear;
0 commit comments