Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 13, 2022. It is now read-only.

Commit 267d816

Browse files
committed
solution wesbos#12
1 parent 63a3710 commit 267d816

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

12 - Key Sequence Detection/index-START.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@
66
<script type="text/javascript" src="http://www.cornify.com/js/cornify.js"></script>
77
</head>
88
<body>
9-
<script>
10-
</script>
9+
<script>
10+
const code = 'bulsara';
11+
let pressedKeys = [];
12+
13+
window.addEventListener('keyup', (evt) => {
14+
pressedKeys.push(evt.key);
15+
pressedKeys.splice(-code.length - 1, pressedKeys.length - code.length);
16+
17+
console.log(pressedKeys);
18+
if (pressedKeys.join('') === code) cornify_add();
19+
});
20+
</script>
1121
</body>
1222
</html>

0 commit comments

Comments
 (0)