Skip to content

Instantly share code, notes, and snippets.

@rainrisa
Created November 28, 2022 05:14
Show Gist options
  • Save rainrisa/e0aa4c1f384880674409a86d6b503877 to your computer and use it in GitHub Desktop.
Save rainrisa/e0aa4c1f384880674409a86d6b503877 to your computer and use it in GitHub Desktop.
Get list of all global variables on a website
Object.keys(window).filter(
(x) =>
typeof window[x] !== "function" &&
Object.entries(Object.getOwnPropertyDescriptor(window, x)).filter(
(entry) =>
["value", "writable", "enumerable", "configurable"].includes(entry[0]) &&
entry[1]
).length === 4
);
@rainrisa
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment