Three key game in javascript