We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e89858d commit bee31cfCopy full SHA for bee31cf
1 file changed
12 - Key Sequence Detection/index-RIO.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
+ let hist = [];
11
+ const secretCode = 'rio';
12
+
13
+ function detectCode(e) {
14
+ console.log(hist);
15
+ hist.push(e.key);
16
+ if(hist.length > secretCode.length) hist.shift();
17
+ if(hist.join('') == secretCode) alert('yea you are!');
18
+ }
19
20
+ document.addEventListener('keyup', detectCode);
21
+</script>
22
+</body>
23
+</html>
0 commit comments