@@ -18,7 +18,7 @@ console.log(`The percentage change is ${percentageChange}`);
1818 a) How many function calls are there in this file? Write down all the lines where a function call is made
1919
2020 -------- Number(carPrice.replaceAll(",", "")); this convert string in numbers
21- -------- replaceAll(",", "") this line is removing the "," and returning just the numbers
21+ -------- replaceAll(",", "") this function is removing the "," and returning just the numbers
2222 -------- console.log(`The percentage change is ${percentageChange}`); this is a function to print what we call inside.
2323
2424
@@ -44,11 +44,11 @@ console.log(`The percentage change is ${percentageChange}`);
4444 e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
4545
4646 ------- The expression Number(carPrice.replaceAll(",", "")) performs two actions:
47- * carPrice.replaceAll(",", ""):
47+ * carPrice.replaceAll(",", ""):
4848 The replaceAll() method is used on the string carPrice. It removes all commas "," from the
4949 string by replacing them with an empty string "".
5050
51- * Number(...);
51+ * Number(...);
5252 this function is then called on the result of replaceAll(),
5353 converting the string now without commas into a numeric value eg 10,000 => 10000
5454
0 commit comments