When you use /
on strings, the strings are implicitly converted to numbers and then division operation is performed.
This may work in all browsers, but it’s always good practice to convert to number explicitly using parseInt
or parseFloat
or other method.
parseInt("101", 10) / 100
Or
parseFloat("101") / 100