A Pen by Evgeniy Kazakov on CodePen.
Created
August 24, 2013 19:02
-
-
Save ekazakov/6329868 to your computer and use it in GitHub Desktop.
A Pen by Evgeniy Kazakov.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict" | |
console.clear(); | |
function classof(o) { | |
if ( o === null ) return "Null"; | |
if ( o === undefined ) return "Undefined"; | |
return Object.prototype.toString.call(o).slice(8, -1); | |
} | |
console.log( classof(null)); | |
console.log( classof(undefined)); | |
console.log( classof(1)); | |
console.log( classof("")); | |
console.log( classof(false)); | |
console.log( classof({})); | |
console.log( classof([])); | |
console.log( classof(/./)); | |
console.log( classof(new Date())); | |
console.log( classof(window)); | |
function f() {} | |
console.log( classof(new f())); | |
var o; | |
var b = function() {}; | |
b.prototype.y = 1; | |
o = new b(); | |
o.x = 2; | |
b.prototype.z = 2; | |
console.log( o) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment