You could go with less loops, although there is an impact on memory usage as you will keep counts on all unique entries in the original range:
function MODEMULT(range) {
var n = range.length,
// object to hold the number of occurrences per entry
count= {},
// array to hold those numbers which have the current max occurrences
maxItems = [],
// reference to the current maximum
max = 0,
// JSLint placement of currentItem used inside the loop
currentItem;
for (var i = 0; i < n; i++) {
currentItem= range[i];
// Update the occurrences table.
count[currentItem] = count[currentItem] ? count[currentItem] + 1 : 1;
// If a new maximum is created, void the original maxItems and update max.
if (count[currentItem] > max) {
max = count[currentItem];
maxItems = [];
}
// If the entry reaches the current max, add it to maxItems.
if (count[currentItem] === max) {
maxItems[maxItems.length] = currentItem;
}
}
// No need for unique, as a duplicate value
// will increase max and thus empty out maxItems.
return maxItems;
}