JavaScript mind game