Since .map (and also .forEach) will skip sparse values there's no option except to use a loop, but you should explicitly check for the absence of the missing keys
for (var i = 0, n = a.length; i < n; ++i) {
if (!(i in a)) { // explicit check for missing sparse value
a[i] = "default";
}
}