Easily find all available global variables in document. No guessing. No manually filtering through Object.keys(window).
npm install get-globals> Easily find all available global variables in document. No guessing. No manually filtering through Object.keys(window).
Objec.keys(window).forEach(key => console.log(key)) and match output against values from ECMAScript specification and those non-standard provided by various browser vendorglobal.printGlobals() and just look at output(And yea - I suggest you to go with #3.)
Install using npm:
``sh`
npm install get-globals
`javascript
import globals from 'get-globals';
window.sampleVariable;
window.anotherVariable = true;
// assign output to variable
const availableGlobals = globals.getGlobals();
// availableGlobals = ['sampleVariable', 'anotherVariable'];
// ...or just log global variables
global.printGlobals();
// prints: Available global variables: sampleVariable, anotherVariable.
`
Planed. Stay tuned.
Returns all available global variables.#####
globals.printGlobals()
Logs all available global variables using console.log`.If you have any problem or suggestion please open an issue here.