Skip to content

Instantly share code, notes, and snippets.

@Marak
Created May 19, 2010 01:35
Show Gist options
  • Save Marak/405836 to your computer and use it in GitHub Desktop.
Save Marak/405836 to your computer and use it in GitHub Desktop.
var n = 45;
sys.puts(typeof n);
sys.puts(n instanceof Number);
var m = Number(45);
sys.puts(typeof n);
sys.puts(n instanceof Number);
var o = new Number(45);
sys.puts(typeof n);
sys.puts(n instanceof Number);
@Marak
Copy link
Author

Marak commented May 19, 2010

this gist is broken and not for consumption of anything, notice the variables are wrong.

also for fun...

      exports.isNumber = function( numbery ){

        if(numbery.toString() == 'NaN'){
          return false;  
        }
        if(numbery instanceof Number){
          return true; 
        }
        else{
          return false;
        }

      };


      format.js lib/types

      isNumber() on a number instance
       - this is a number
      isNumber() on a string number 
       - this is not a number
      isNumber() on number literal
       - this is not a number
      isNumber() on string with randomly placed numbers
       - this is not a number

      Verified 4 vows in 0.002 seconds.

      4 honored, 0 broken, 0 errored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment