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 a544605 commit a23ff30Copy full SHA for a23ff30
12 - Key Sequence Detection/index.html
@@ -0,0 +1,25 @@
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 = 'morganma';
12
+
13
+ window.addEventListener('keyup', (e) => {
14
+ pressed.push(e.key);
15
+ pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
16
+ console.log(pressed);
17
+ if(pressed.join("").endsWith(secretCode)) {
18
+ console.log("You got it!");
19
+ cornify_add();
20
+ }
21
+ })
22
23
+</script>
24
+</body>
25
+</html>
0 commit comments