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
@@ -12,27 +12,27 @@ console.log(`The percentage change is ${percentageChange}`);
12
12
// Read the code and then answer the questions below
13
13
14
14
// a) How many function calls are there in this file? Write down all the lines where a function call is made
15
-
// there are 5 function calls in this file. including methods used , 2 methods = replaceAll(), methods are called under their object, replaceAll() is called under the string object.
16
-
// The lines where a function call is made are:
17
-
// Line 4: carPrice.replaceAll(",", "")
18
-
// Line 5: priceAfterOneYear.replaceAll(",", "")
19
-
// Line 7: console.log(`The percentage change is ${percentageChange}`)
15
+
// there are 5 function calls in this file. including methods used , 2 methods = replaceAll(), methods are called under their object, replaceAll() is called under the string object.
16
+
// The lines where a function call is made are:
17
+
// Line 4: carPrice.replaceAll(",", "")
18
+
// Line 5: priceAfterOneYear.replaceAll(",", "")
19
+
// Line 7: console.log(`The percentage change is ${percentageChange}`)
20
20
21
21
// 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?
22
-
//syntaxError: missing ) after argument list, -
23
-
//the error is occurring because of a missing "," in the replaceAll() method. in line 5.
22
+
//syntaxError: missing ) after argument list, -
23
+
//the error is occurring because of a missing "," between arguments in the replaceAll() method. in line 5.
24
24
25
25
// c) Identify all the lines that are variable reassignment statements
26
-
// The lines that are variable reassignment statements are:
27
-
// Line 4: carPrice = Number(carPrice.replaceAll(",", ""));
28
-
// Line 5: priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
26
+
// The lines that are variable reassignment statements are:
27
+
// Line 4: carPrice = Number(carPrice.replaceAll(",", ""));
28
+
// Line 5: priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
29
29
30
30
// d) Identify all the lines that are variable declarations
31
-
// The lines that are variable declarations are:
32
-
// Line 1: let carPrice = "10,000";
33
-
// Line 2: let priceAfterOneYear = "8,543";
34
-
// Line 7: const priceDifference = carPrice - priceAfterOneYear;
0 commit comments