Nodejs Number Value Check isBetween(min, max, inclusive)

Here you can find the source of isBetween(min, max, inclusive)

Method Source Code

Number.prototype.isBetween = function (min, max, inclusive) {
  return inclusive
    ? this >= min && this <= max
    : this > min && this < max;
};

Related

  1. isOdd()
    function isOdd(num) {
      if (typeof num === 'number') {  
        return ((num % 2) === 1) || ((num % 2) === -1) ? true : false;
      else {
        throw 'Not a number';
    console.log(isOdd(3)); 
    ...
    
  2. isOdd()
    Number.prototype.isOdd = function() {
        return !!(this % 2);
    
  3. odd()
    Number.prototype.odd = function () {
      return (this % 2 == 1)
    
  4. odd()
    Number.prototype.odd = function(){
      return ( ( this % 2 ) == 1 )
    
  5. isBetween(l,h)
    Number.prototype.isBetween = function(l,h){
      return (this >= l.val() && this <= h.val());
    
  6. isBetweenisBetween(a, b)
    Number.prototype.isBetween = function isBetween(a, b) {
      if(a <= this) {
        return this <= b;
      return this >= b;
    
  7. even()
    Number.prototype.even = function(){
        return (this % 2 === 0);
    };
    
  8. 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)
    ...
    
  9. isNumber()
    String.prototype.isNumber = function(){
      return !isNaN(this);
    };