Bowling calculator in Javascript