Skip to content

Commit d7d656b

Browse files
committed
completed task in Sprint-1/2-mandatory-interpret/1-percentage-change.js
1 parent df3c3a8 commit d7d656b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Sprint-1/3-mandatory-interpret/1-percentage-change.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@ console.log(`The percentage change is ${percentageChange}`);
1313

1414
// a) How many function calls are there in this file? Write down all the lines where a function call is made
1515

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+
1621
// 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?
1722

23+
//The error is coming from line 5 due to a missing comma in the replaceAll method. It should be replaceAll(",","")
24+
1825
// c) Identify all the lines that are variable reassignment statements
1926

27+
// lines 4 and 5
28+
2029
// d) Identify all the lines that are variable declarations
2130

31+
//lines 1, 2, 7 and 8
32+
2233
// 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

Comments
 (0)