10-Pin Bowling in javascript