Skip to content

Commit 6d1fdd2

Browse files
committed
Answer all questions
1 parent ced7487 commit 6d1fdd2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ console.log(`The percentage change is ${percentageChange}`);
1212
// Read the code and then answer the questions below
1313

1414
// a) How many function calls are there in this file? Write down all the lines where a function call is made
15+
//5 function calls. 2 in line 7, 2 in line 8, 1 in line 10
1516

1617
// 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+
//Error is from line 5, no comma separating arguments for replace all. fix by adding comma after ","
1719

1820
// c) Identify all the lines that are variable reassignment statements
21+
//4 and 5
1922

2023
// d) Identify all the lines that are variable declarations
24+
//1, 2, 7, 8
2125

2226
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
27+
//takes the string 10,000 and replaces all the commas with empty string, effectively removing the comma
28+
//makes the string into number format so it can be converted to a number

0 commit comments

Comments
 (0)