Rather than `mod` Javascript has % (remainder). This is the same as
mod for integer arguments, but is fmod for floating arguments. And
rather than `div` it has Math.floor, Math.ceiling, and Math.round, so
that you can specify how the division should be rounded.
I think I would test `foo == Math.round(foo)` myself, although you
need to do more work to ensure foo is a number to start with, if you
don't already know:
js> "" == Math.round("")
true
js> "blart" == Math.round("blart")
false
js> Infinity == Math.round(Infinity)
true
js> Math.PI == Math.round(Math.PI)
false
js>
On 2006-11-12, at 05:25 EST, Frisco Del Rosario wrote:
Is (foo mod 1)==0 a valid test for whether foo is an integer, and
if so, has LZX implemented the mod and div operators?
Frisco Del Rosario
Tester, OpenLaszlo and IDE4Laszlo