javacript % operator

% operator means divide remaining in javacript but i found it does not work with scaling,

so in order to make it work you have to multiply the number by 10*n

 

for example:

 

var a = 10

var b = 0.05

var result = (parseFloat(a) * 100) % (parseFloat(b) * 100)

 

result  will be 0 otherwise result will be 0.49999999945 or something like that

 

Cheers

你可能感兴趣的:(Opera)