Visitar URL original
Day 12 completed · wesbos/JavaScript30@c346cfa · GitHub
Skip to content

Commit c346cfa

Browse files
committed
Day 12 completed
1 parent f0c6d2a commit c346cfa

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
const pressed = [];
11+
const secretCode = 'wesbos';
12+
13+
window.addEventListener('keyup', (e) => {
14+
pressed.push(e.key);
15+
pressed.splice(-secretCode.legnth - 1, pressed.length - secretCode.length);
16+
17+
if (pressed.join('').includes(secretCode)) {
18+
cornify_add();
19+
}
20+
});
21+
</script>
22+
</body>
23+
</html>

0 commit comments

Comments
 (0)