We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eaf1ab1 commit 66896ccCopy full SHA for 66896cc
1 file changed
12 - Key Sequence Detection/index-WORKING.html
@@ -0,0 +1,23 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+ <meta charset="UTF-8">
5
+ <title>Key Detection</title>
6
+ <script type="text/javascript" src="http://www.cornify.com/js/cornify.js"></script>
7
+</head>
8
+<body>
9
+<script>
10
+const pressed = [];
11
+const secretCode = 'wesbos';
12
+window.addEventListener('keyup', e => {
13
+ pressed.push(e.key);
14
+ pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
15
+ console.log(pressed);
16
+ if(pressed.join('').includes(secretCode)) {
17
+ console.log('DING DING!');
18
+ cornify_add();
19
+ }
20
+})
21
+</script>
22
+</body>
23
+</html>
0 commit comments