Implementing the Konami codes

Found this on Reddit comments while reading about Facebook implementing the code on their pages. (heh)

Here’s how to do this.


konami = function()
{
	alert('konami');
};
var r = [];
document.onkeydown = function(event)
{
	r.push(event.keyCode);
	if (r.length > 11)
		r.shift();
	if (r.join('') == '3838404037393739666513')
		konami();
};

Demo here.

Konamicodesites.com has a list of the websites implementing the Konami codes.

Comments 1

  1. alex wrote:

    I like the demo… I swear I played that game (Contra) a long time ago on the Sega Mega Drive (I believe it’s called the Genesis in other parts of the world).

    Posted 09 Sep 2009 at 6:04 am

Post a Comment

Your email is never published nor shared. Required fields are marked *