The way you are doing it now works, but isn't ideal. I have benchmarked your answer vs the answers from the comments and here are the results.
Winner:
const result = (parseFloat(number) * 100).toString();
Second Place (~99% of Winner):
const result = (Number(number) * 100).toString();
Third Place (~96% of Winner):
const result = (+number * 100).toString();
Fourth Place (~80% of Winner):
const result = number.replace(".", "");
As noted, your method will not work when the string does not match /\d\.\d\d/
however the other methods will work.
Tested on Safari 14
const separe = Number(number) ? Number(number * 100).
– Yseult0.02
, would they want002
? Or should it be2
? – Fears"7"
. But the user could even do:"75¢"
. If it's always#.##
then your solution will work, otherwise it won't. – Fears