Every once in a blue moon, I like to hack up some crazy toy proof of concept to get away from everyday's stiff serious production-ready coding. This morning, I decided to mess around with an idea of implementing something similar to Svelte's reactive variables, but using pure Javascript.
So here's that godawful eye-bleeding fun hack: a 7-line "svelte" (needless to say, it doesn't do nearly enough to be useful in the real world and breaks just about every best practice rule in the book because why the hell not)
https://codepen.io/lhorie/pen/BaRzgRe
Can you figure out why this works? Any ideas to make it more devilish/clever/insane are welcome :)
Why use
document.querySelector
when you can refer to elements directly by their IDs? 🤓 https://codepen.io/Sequoia/pen/MWmjgzg