Number.js

Contains the Number prototypes.

License

MIT-style license.

Summary
Number.jsContains the Number prototypes.
NumberA collection of The Number Object prototype methods.
Properties
toIntReturns this number; useful because toInt must work on both Strings and Numbers.
toFloatReturns this number as a float; useful because toFloat must work on both Strings and Numbers.
limitLimits the number.
roundReturns the number rounded to specified precision.
timesExecutes a passed in function the specified number of times

Number

A collection of The Number Object prototype methods.

Summary
Properties
toIntReturns this number; useful because toInt must work on both Strings and Numbers.
toFloatReturns this number as a float; useful because toFloat must work on both Strings and Numbers.
limitLimits the number.
roundReturns the number rounded to specified precision.
timesExecutes a passed in function the specified number of times

Properties

toInt

Returns this number; useful because toInt must work on both Strings and Numbers.

toFloat

Returns this number as a float; useful because toFloat must work on both Strings and Numbers.

limit

Limits the number.

Arguments

minnumber, minimum value
maxnumber, maximum value

Returns

the number in the given limits.

Example

(12).limit(2, 6.5)  // returns 6.5
(-4).limit(2, 6.5)  // returns 2
(4.3).limit(2, 6.5) // returns 4.3

round

Returns the number rounded to specified precision.

Arguments

precisioninteger, number of digits after the decimal point.  Can also be negative or zero (default).

Example

12.45.round() // returns 12
12.45.round(1) // returns 12.5
12.45.round(-1) // returns 10

Returns

The rounded number.

times

Executes a passed in function the specified number of times

Arguments

functionthe function to be executed on each iteration of the loop

Example

(4).times(alert);

Documentation by Aaron Newton & Mootools Developers, generated by NaturalDocs and GeSHi