Probability homework completed using JavaScript