0

I have this simple jsfiddle code. And I am confused why I get these results:

for 21 I get 2

for 23 I get 1,999999999998

for 25 I get 2

for 28 I get 1,999999999998

for 18 I get 1

for 38 I get 3

What's up with 23 and 28 ?

Code:

var x = prompt(x);
x = x/10 - x%10 / 10;
alert(x);
mad scientist
  • 285
  • 1
  • 6
  • 14

0 Answers0