Workshop › Rhythm Lanes › Step 29 of 35
How well did you play? A perfect counts fully, a good half, a miss nothing, divided by the number of notes judged: a percentage.
```js
const accuracy = () => {
const total = judged.perfect + judged.good + judged.miss
return total === 0 ? 100 : Math.round((100 * (judged.perfect + judged.good * 0.5)) / total)
}
```return gives the result.total is the number of notes judged so far. With none, the accuracy is 100.* 0.5); Math.round rounds to the nearest whole number.Write accuracy above function update() {, with an empty line after it.
Skills: Functions