Skip to content

Commit 5fc5375

Browse files
committed
Lesson 12
1 parent f88ff51 commit 5fc5375

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 keys = [];
11+
const sequence = 'thiago';
12+
13+
window.addEventListener(
14+
'keyup',
15+
function(e) {
16+
keys.push(e.key);
17+
keys.splice(
18+
-sequence.length - 1,
19+
keys.length - sequence.length
20+
)
21+
console.log(keys);
22+
if(keys.join('').includes(sequence)){
23+
cornify_add();
24+
}
25+
}
26+
);
27+
</script>
28+
</body>
29+
</html>

0 commit comments

Comments
 (0)