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,11 +12,17 @@ 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
+
// Answer: There are five function calls in this file. function was called on line 4 (twice), line 5 (twice) and line 10.
15
16
16
17
// 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?
18
+
// Answer:
19
+
// After running the code, the error occurred because a comma was missing between the quotation marks on line 5. I fixed it by adding the missing comma.
17
20
18
21
// c) Identify all the lines that are variable reassignment statements
22
+
// Answer: Variable reassignment statements occurred on lines 4 and 5
19
23
20
24
// d) Identify all the lines that are variable declarations
25
+
// Answer: Variable declarations occurred on lines 1, 2, 7, and 8.
21
26
22
27
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
28
+
// Answer: The .replaceAll() method runs first to find all the comma in the variable carPrice and replace them with nothing then the Number() functions runs to convert the value to a number data type
0 commit comments