I have a function that takes a config object as an argument. Within the function, I also have default object. Each of those
config
default
You can loop through Object's properties using for statement.
for
var settings = extend(default, config); function extend(a, b){ var c = {}; for(var p in a) c[p] = (b[p] == null) ? a[p] : b[p]; return c; }