Skip to content

Commit b6b4ffc

Browse files
committed
Answering the questions
1 parent f4e13bc commit b6b4ffc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ 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-
15+
// five fuction calls, in line 4, number(), and replaceAll(). in line 5, number() and replaceAll(), in line 8, console.log().
1616
// 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-
17+
//in line 5, a syntax error because of the missing comma inside the replaceAll method parentheses. we can fix this problem by adding the missing comma.
1818
// c) Identify all the lines that are variable reassignment statements
19-
19+
// in line 4 carPrice variable is reassigned and in line 5 priceAfterONeYear as well.
2020
// d) Identify all the lines that are variable declarations
21-
21+
// four variable declarations in line 1 carPrice variable is declared, in line 2 priceAfterOneYear variable is declared, in line 7 priceDifference variable is declared, and in line 8 percentageChange variable is declared.
2222
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
23+
// the purpose of this expression number(carPrice.replaceAll(",","")) is to change a string value that contains commas into a number value by removing the commas first using the replaceAll method and then converting the resulting string into a number using the Number function.

0 commit comments

Comments
 (0)