AFFILIATE LINKS
Great resource I use to learn algorithms.
40% off Tech Interview Pro: http://techinterviewpro.com/terriblewhiteboard
20% off CoderPro: http://coderpro.com/terriblewhiteboard
Here is the full implementation.
let trailingZeroes = function(n) {
let numberOfFives = 0;
while (n >= 5) {
numberOfFives += Math.floor(n / 5);
n = Math.floor(n / 5);
}
return numberOfFives;
};