Created
May 18, 2017 15:02
-
-
Save zerobias/f515c37fd9721188be4973e5adcdb67f to your computer and use it in GitHub Desktop.
Print prototype stack
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
function pps (obj) { | |
let count = 1 | |
while (obj) { | |
const okeys = Object.keys(obj) | |
const str = okeys.length > 0 ? | |
`[${okeys.join(', ')}]` : `[${obj.constructor.name}]` | |
console.log(`[${count++}]: ${str}`) | |
obj = Object.getPrototypeOf(obj) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment