I have an identity function:
theIdentity = function(val) {
return val;
};
And a function that is going to reduce an array:
theReduce = function(collection, iterator, accumulator) {
iterator = iterator || theIdentity;
};
I am having trouble understanding this line:
iterator = iterator || theIdentity;
I know it is supposed to check if the iterator is undefined and assign it as theIdentity if it is, but anymore insight would be appreciated.