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