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
Copy file name to clipboardExpand all lines: Sprint-1/3-mandatory-interpret/1-percentage-change.js
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,23 @@ 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
17
+
//line 4 has 2 function calls - Number and replaceAll
18
+
//line 5 has 2 function calls - Number and replaceAll
19
+
// line 10 has 1 function call - console.log
20
+
16
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?
17
22
23
+
//The error is coming from line 5 due to a missing comma in the replaceAll method. It should be replaceAll(",","")
24
+
18
25
// c) Identify all the lines that are variable reassignment statements
19
26
27
+
// lines 4 and 5
28
+
20
29
// d) Identify all the lines that are variable declarations
21
30
31
+
//lines 1, 2, 7 and 8
32
+
22
33
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
34
+
35
+
//This expression is removing all the commas from the carPrice string and converting it into a number so that mathematical operations can be performed on it.
0 commit comments