You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sprint-1/3-mandatory-interpret/1-percentage-change.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,4 +28,6 @@ console.log(`The percentage change is ${percentageChange}`);
28
28
29
29
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
30
30
31
-
// Martin answer - the purpose of this expression is to use the replace all method to replace the comma in the carPrice price expression with a blank so that the expression reads "10000". This is converted to a number using the number function converting the string "10000" to a number 10000
31
+
/*
32
+
Martin answer - the purpose of this expression is to use the replaceAll method using a search string and replacement string. In this case all commas are removed from carPrice (",") and replaced with a blank (""), converting the formatted number of "10,000" to "10000". This is passed into a Number() method which converts the string to a number - 10000
0 commit comments