Skip to content

Instantly share code, notes, and snippets.

@psqq
Created July 27, 2021 01:22
Show Gist options
  • Save psqq/d23a5c688564cf5a19dd1b2004ed6c0c to your computer and use it in GitHub Desktop.
Save psqq/d23a5c688564cf5a19dd1b2004ed6c0c to your computer and use it in GitHub Desktop.
{
name: 'Calculator',
run() {
document.body.innerHTML = `
<input type="text"><br><br>
Result: <span></span>
`;
var result = document.querySelector('span');
var input = document.querySelector('input');
input.onkeyup = () => {
result.innerText = eval("(" + input.value + ")");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment