Skip to content

Commit 6a3036e

Browse files
committed
feat: add challenge wesbos#12
1 parent 6bf0d29 commit 6a3036e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

12 - Key Sequence Detection/index-START.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
</head>
88
<body>
99
<script>
10+
const pressed = [];
11+
const secretCode = 'paul';
12+
window.addEventListener('keyup', (e) => {
13+
pressed.push(e.key);
14+
pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
15+
if(pressed.join('').includes(secretCode)) console.log('code matches');
16+
})
1017
</script>
1118
</body>
1219
</html>

0 commit comments

Comments
 (0)