3 A collection of The Number Object prototype methods.
10 Returns this number; useful because toInt must work on both Strings and Numbers.
14 return parseInt(this);
19 Returns this number as a float; useful because toFloat must work on both Strings and Numbers.
23 return parseFloat(this);
31 min - number, minimum value
32 max - number, maximum value
35 the number in the given limits.
38 >(12).limit(2, 6.5) // returns 6.5
39 >(-4).limit(2, 6.5) // returns 2
40 >(4.3).limit(2, 6.5) // returns 4.3
43 limit: function(min, max){
44 return Math.min(max, Math.max(min, this));
49 Returns the number rounded to specified precision.
52 precision - integer, number of digits after the decimal point. Can also be negative or zero (default).
55 >12.45.round() // returns 12
56 >12.45.round(1) // returns 12.5
57 >12.45.round(-1) // returns 10
63 round: function(precision){
64 precision = Math.pow(10, precision || 0);
65 return Math.round(this * precision) / precision;
70 Executes a passed in function the specified number of times
73 function - the function to be executed on each iteration of the loop
80 for (var i = 0; i < this; i++) fn(i);