Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Created November 30, 2009 10:08
Show Gist options
  • Select an option

  • Save jakearchibald/245379 to your computer and use it in GitHub Desktop.

Select an option

Save jakearchibald/245379 to your computer and use it in GitHub Desktop.
function(obj) {
if (obj.constructor.name) {
return obj.constructor.name;
} else {
var constructorStr = obj.constructor.toString();
return constructorStr.slice( constructorStr.indexOf('function ') + 9, constructorStr.indexOf('(') );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment