Skip to content

Commit

Permalink
end exercice key detection
Browse files Browse the repository at this point in the history
  • Loading branch information
AnaAC committed Oct 28, 2018
1 parent 267f2f9 commit dd13f27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 12-key-sequence-detection/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
</head>
<body>
<script>
const pressed = [];
const secretCode = 'great';
window.addEventListener('keyup', (e) => {
pressed.push(e.key);
pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
if (pressed.join('').includes(secretCode)) {
cornify_add();
}
});
</script>
</body>
</html>

0 comments on commit dd13f27

Please sign in to comment.