Skip to content

Instantly share code, notes, and snippets.

@jameswomack
Created March 12, 2014 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameswomack/9501068 to your computer and use it in GitHub Desktop.
Save jameswomack/9501068 to your computer and use it in GitHub Desktop.
Making `instanceof` work on multi-level inheritance structures with JavaScript
function DepartmentStore() {}
DepartmentStore.prototype = Object.create(Function);
var departmentStore = new DepartmentStore;
console.log(departmentStore instanceof Function);
console.log(departmentStore instanceof DepartmentStore);
/*
true
true
[Function: DepartmentStore]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment