I mean, you have to know minimal math
const exactPercent = totals[index] / totals * 100
const percent = isNaN(exactPercent) ? 0 : exactPercent - Math.floor(exactPercent) === 0
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.