List of utility methods to do Number Value Check
odd()Number.prototype.odd = function(){ return ( ( this % 2 ) == 1 ) | |
isBetween(l,h)Number.prototype.isBetween = function(l,h){ return (this >= l.val() && this <= h.val()); | |
isBetween(min, max, inclusive)Number.prototype.isBetween = function (min, max, inclusive) { return inclusive ? this >= min && this <= max : this > min && this < max; }; | |
isBetweenisBetween(a, b)Number.prototype.isBetween = function isBetween(a, b) { if(a <= this) { return this <= b; return this >= b; | |
even()Number.prototype.even = function(){ return (this % 2 === 0); }; | |
even()var puts = require("sys").puts; Number.square = function(n) { return n * n Number.even = function(n) { return n % 2 == 0 Number.odd = function(n) { return !this.even(n) ... | |
isNumber()String.prototype.isNumber = function(){ return !isNaN(this); }; | |
isNumber()String.prototype.isNumber = function(){ var pattern=/^[+\-]?\d+(.\d+)?$/; flag=pattern.test(this); if(flag) return true; return false; | |
isNumber()String.prototype.isNumber = function (){ var str = this; return !isNaN(str); | |
isNumber()String.prototype.isNumber = function() return (/^\d+$/.test(this.Trim())); |