how to get the number, which is after the point in a float number in typescript. e.g.
2.3 I want to get 3 as return
how to get the number, which is after the point in a float number in typescript. e.g.
2.3 I want to get 3 as return
I will try with something simple like:
const num = 2.3;
const decimals = (num - Math.floor(num)); // 0.3
so you get the integer part and then you subtract it from the original number in this way there's no need to do any string/number/string conversion
To expand on Gurdevs answer
const num = 2.3
console.log(num.toString().split('.')[1])