Visitar URL original
12th exercise done · wesbos/JavaScript30@5aee57b · GitHub
Skip to content

Commit 5aee57b

Browse files
committed
12th exercise done
1 parent ec31162 commit 5aee57b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎12 - Key Sequence Detection/index-START.html‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
</head>
88
<body>
99
<script>
10+
const pressed = [];
11+
const secretCode = 'sean';
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)) {
16+
cornify_add();
17+
}
18+
});
1019
</script>
1120
</body>
1221
</html>

0 commit comments

Comments
 (0)