Skip to content

Commit 420dc77

Browse files
committed
inserted indentations for better readability
1 parent 149b8cd commit 420dc77

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +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-
//answer: we have 5 function calls across 3 lines:
16-
//line 4
17-
//line 5
18-
//line 10
15+
//answer: we have 5 function calls across 3 lines:
16+
//line 4
17+
//line 5
18+
//line 10
19+
1920
// 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-
//answer: on line 5, there is a typo, a replaceAll("," ""));
21-
//fix line 5 by changing it to priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
21+
//answer: on line 5, there is an error caused by a missing comma replaceAll("," ""));. Can be fixed by changing it to priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));
22+
2223
// c) Identify all the lines that are variable reassignment statements
23-
//answer: lines 4 and 5
24+
//answer: lines 4 and 5
25+
2426
// d) Identify all the lines that are variable declarations
25-
//answer: line 1, 2, 7 and 8
27+
//answer: line 1, 2, 7 and 8
28+
2629
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
27-
//answer: .ReplaceAll(",", "") this will remove a comma from the price string and number will convert that clean string into a numeric value so mathematical calculations can be perfomed.
30+
//answer: .ReplaceAll(",", "") this will remove every comma from the price string and number will convert that clean string into a numeric value so mathematical calculations can be performed.

0 commit comments

Comments
 (0)