javascript - I want to compare 2 decimals to see which one is greater -
i want compare 2 decimals see 1 greater.
this doesn't seem working decimals , works integers (e.g. 1 > 2) , doesn't work floats (1.67 > 1.98).
this example doesn't work:
this.testorder = (vala, valb): boolean => { const radix = 10; return parseint(vala, radix) > parseint(valb, radix); };
use parsefloat
instead of parseint
.
parseint
takes integer part of string.
Comments
Post a Comment