Skip to content

Commit 647c50a

Browse files
committed
Answered the questions in the comments area in 1-percentage-change.js
1 parent 1dc53ce commit 647c50a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ 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 times its been called:
16+
// 4 and 5 for Number and replaceAll
17+
// 10 for log
1518

1619
// 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?
20+
// SyntaxError, its from line 5 in replaceAll("," "")
21+
// its missing a , between the two arguments so it needs to be (",", "")
1722

1823
// c) Identify all the lines that are variable reassignment statements
24+
// There are two reassignment statements in lines 4 and 5
1925

2026
// d) Identify all the lines that are variable declarations
21-
27+
// They are 1,2 and 7,8
2228
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
29+
// It is using Number to make the string into a number but in order to do that the string needs to contain numerical letters only.
30+
// So it then uses in the () to remove all of the , with nothing using the replaceAll function so that 10,000 becomes 10000

0 commit comments

Comments
 (0)