Prototypes of Global this
by tjcrowder
JavaScript
const toString = Object.prototype.toString;
let obj = this;
let description = "global `this`";
while (obj) {
console.log(`${description} (${toString.call(obj)})`);
obj = Object.getPrototypeOf(obj);
description = "prototype of " + description;
}