Refactor the KonamiCode example JS code by using early added method