Skip to content

Instantly share code, notes, and snippets.

@codingwithsara
Created November 8, 2018 14:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save codingwithsara/918637d9484c548f143d21ba1c9d46a0 to your computer and use it in GitHub Desktop.
Stopwatch with JavaScript (2) – Start & Stop with Spacebar –
...
document.onkeydown = function(event) {
if (event) {
if (event.keyCode == 32 || event.which == 32) {
if(status == 1) {
stop();
} else if (status == 0) {
start();
}
}
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment