JSFiddle - React, Tailwind, and code Playground

by beneverard

HTML

↑ ↑ ↓ ↓ ← → ← → B A

JavaScript

$(document).ready(function() {
   
    var keys  = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65],
        count = 0;
    
    $('body').keydown(function(event) {
        
        event.keyCode == keys[count] ? count++ : count = 0;
        
        if (count === keys.length) {
            alert('success');
        }            
        
    });
    
});