-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkonami.html
More file actions
35 lines (29 loc) · 734 Bytes
/
konami.html
File metadata and controls
35 lines (29 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<title>Konami Code</title>
</head>
<body>
<h1>Konami Code</h1>
<script src="/js/jquery-3.6.4.js" integrity="sha256-a9jBBRygX1Bh5lt8GZjXDzyOB+bWve9EiO7tROUtj/E=" crossorigin="anonymous"></script>
<script>
"use strict";
let konami = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13];
let user = [];
let counter = 0;
$(document).keyup(function(event){
console.log(event.keyCode);
user.push(event.keyCode);
if(konami[counter] !== user[counter]){
alert("konami code not correct");
}
else if(konami[konami.length-1] === user[konami.length-1]){
alert("correct konami code - you get 30 lives!");
}
else{
counter++;
}
});
</script>
</body>
</html>