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
@@ -13,10 +13,39 @@ console.log(`The percentage change is ${percentageChange}`);
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
15
16
+
// There are 5 function calls in this file. They are on lines 1, 2, 4, and 5. The functions being called are replaceAll() and Number().
17
+
// Line 4: replaceAll and Number (2)
18
+
// Line 5: replaceAll and Number (2)
19
+
// Line 10: console.log (1)
20
+
21
+
22
+
16
23
// 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?
17
24
25
+
// The error is occuring on line 5. It is occuring because there is a missing comma between the replaceAll "".
26
+
// We can fix this by adding a comma between the two empty strings in the replaceAll function on line 5, like this: priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
27
+
28
+
29
+
18
30
// c) Identify all the lines that are variable reassignment statements
0 commit comments