Jumping game test in javascript