I'm receiving some data which I need to turn them to numbers, make some computation with that and then I need to use the same data in another place but as a string.
I'm using parseFloat()
but the problem is that it already removes the letters part of that number.
const string = parseFloat("100 MB")
console.log(string) // 100
Is there something else other than parseFloat()
to turn a string into a number but somehow keep the MB
part of the string if I want to turn it back as the original string?