forked from avoidwork/abaaso
-
Notifications
You must be signed in to change notification settings - Fork 0
number
avoidwork edited this page Apr 24, 2012
·
1 revision
Number related methods
$(".class").each(function (i, idx) { if (idx.isOdd()) i.addClass("odd"); });
Returns the difference of arg
@param {Number} arg Number to compare
@return {Number} The absolute difference
Prototype
Number.prototype.diff
Example
Number(5).diff(2); // 3
Tests if an number is even
@param {Number} arg Number to test @return {Boolean} True if even
Prototype
Number.prototype.isEven
Example
Number(0).isEven(); // true
Formats a Number to a delimited String
@param {Number} arg Number to format
@param {String} delimiter [Optional] String to delimit the Number with
@param {String} every [Optional] Position to insert the delimiter, default is 3
@return {String} Number represented as a comma delimited String
Prototype
Number.prototype.format
Example
Number(1024).format(); // "1,024"
Tests if an number is odd
@param {Number} arg Number to test @return {Boolean} True if odd
Prototype
Number.prototype.isOdd
Example
Number(1).isOdd(); // true