@@ -13,26 +13,27 @@ 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 4 function calls in this file
17- // Line 4: carPrice.replaceAll(",", "")
18- // Line 4: Number(carPrice.replaceAll(",", ""))
19- // Line 5: priceAfterOneYear.replaceAll("," "")
20- // Line 5: Number(priceAfterOneYear.replaceAll("," ""))
16+ // There are 5 function calls in this file
17+ // Line 4: carPrice.replaceAll(",", "")
18+ // Line 4: Number(carPrice.replaceAll(",", ""))
19+ // Line 5: priceAfterOneYear.replaceAll("," "")
20+ // Line 5: Number(priceAfterOneYear.replaceAll("," ""))
21+ // Line 8: console.log(`The percentage change is ${percentageChange}`)
2122
2223// 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?
2324
24- // The error is coming from line 5
25- // The error is due to a missing comma
26- // Add a comma between the two quotations
25+ // The error is coming from line 5
26+ // The error is due to a missing comma
27+ // Add a comma between the two quotations
2728
2829// c) Identify all the lines that are variable reassignment statements
2930
30- // Line 4 and Line 5
31+ // Line 4 and Line 5
3132
3233// d) Identify all the lines that are variable declarations
3334
34- // Line 1, Line 2, Line 7 and Line 8
35+ // Line 1, Line 2, Line 7 and Line 8
3536
3637// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
3738
38- // The expression is replacing all the commas in the string carPrice with nothing, and then converting it to a number type
39+ // The expression is replacing all the commas in the string carPrice with nothing, and then converting it to a number type
0 commit comments