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
console.log(`The percentage change is ${percentageChange}`);
11
-
12
11
// Read the code and then answer the questions below
13
12
14
13
// a) How many function calls are there in this file? Write down all the lines where a function call is made
@@ -19,4 +18,19 @@ console.log(`The percentage change is ${percentageChange}`);
19
18
20
19
// d) Identify all the lines that are variable declarations
21
20
22
-
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
21
+
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of thi e() and Number().
22
+
23
+
//a) There are 4 function calls. They are on lines 4 and 5. Each line contains two function calls: replaceAll() and Number().
24
+
//b) The error comes from line 5. The replaceAll() function is missing a comma between its two arguments. The problem can be fixed by adding a comma: replaceAll(",", "").
//c) The variable reassignment statements are lines 4 and 5.
27
+
//d) The variable declaration statements are lines 1, 2, 7 and 8.
28
+
29
+
//e) The expression removes the comma from the price string and then converts the result from a string into a number, so JavaScript can use it for calculations.
0 commit comments