/*
#TGIF #JS #WTF
Create a global "variable"
by appending a tag + ID
to the document body.
*/
console.log(typeof global); // undefined
document.body.innerHTML += "<wtf id=global>";
console.log(typeof global); // object
console.log(global.tagName); // WTF
-
-
// or just set the ID of your document's body: console.log(typeof global); // undefined http://document.body.id = "global"; console.log(typeof global) // object
1 reply 0 retweets 3 likesShow this thread -
// to delete the "global" just set the ID to null: console.log(typeof global) // object http://global.id = ""; console.log(typeof global) // undefined
2 replies 0 retweets 4 likesShow this thread
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.