my attempt at creating a solution for the bowling kata in javascript