We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef0b92a commit 6cd9b22Copy full SHA for 6cd9b22
12 - Key Sequence Detection/index-START.html
@@ -7,6 +7,23 @@
7
</head>
8
<body>
9
<script>
10
+const pressed =[];
11
+const secretCode = 'wesbos';
12
+
13
+window.addEventListener('keyup', (e) => {
14
+ console.log(e.key);
15
+ pressed.push(e.key);
16
+ pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
17
+ //negative will take it from the end of the array
18
19
+ if(pressed.join('').includes(secretCode)){
20
+ console.log('yep!');
21
+ cornify_add();
22
+ //will give you random unicorns on the screen!
23
+ }
24
25
+ console.log(pressed);
26
+})
27
</script>
28
</body>
29
</html>
0 commit comments