Your First Web Component (3/7)
Implement the NumberInput.validateAndFormat method:
- Remove the thousands separators (,) from the _internalValue property and
parse it using the parseFloat() function.
- Test if parsing was successful using the isNaN() function.
- Use the Number.prototype.toFixed() method to add the decimal separator (.).
- Use the String.prototype.replace() method to add the thousands separators (,).
Hint: /(\d)(?=(\d{3})+\.)/g matches digits which are followed by at least one 3-digits package and the decimal separator (.)