[Edit march 2013] based on progressing insight this is a better method:
Object.prototype.is = function() { var test = arguments.length ? [].slice.call(arguments) : null ,self = this.constructor; return test ? !!(test.filter(function(a){return a === self}).length) : (this.constructor.name || (String(self).match ( /^function\s*([^\s(]+)/im) || [0,'ANONYMOUS_CONSTRUCTOR']) [1] ); } // usage var Some = function(){ /* ... */} ,Other = function(){ /* ... */} ,some = new Some; 2..is(String,Function,RegExp); //=> false 2..is(String,Function,Number,RegExp); //=> true 'hello'.is(String); //=> true 'hello'.is(); //-> String /[a-z]/i.is(); //-> RegExp some.is(); //=> 'ANONYMOUS_CONSTRUCTOR' some.is(Other); //=> false some.is(Some); //=> true // note: you can't use this for NaN (NaN === Number) (+'ab2').is(Number); //=> true