Skip to content

Instantly share code, notes, and snippets.

@vegerot
Last active November 5, 2022 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vegerot/2ac3932a603a630b62de4a869bece443 to your computer and use it in GitHub Desktop.
Save vegerot/2ac3932a603a630b62de4a869bece443 to your computer and use it in GitHub Desktop.
JavaScript Playground
<html>
<body>
<code>
<script type="module" contenteditable>
console.log("hello, world!");
const script = document.querySelector("script");
script.addEventListener("input", function runScript(e) {
eval(e.target.innerHTML);
script.removeEventListener("input", runScript);
});
</script>
<style contenteditable>
script,
style {
display: block;
white-space: pre;
}
</style>
</code>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment