I saw the use of custom invert function here. There's a javascript library called lodash.js which will help you with array/object manipulation such as invert. I'd recommend going through the doc here.
Your code will go from this:
var invert = function (obj) {
var new_obj = {};
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
new_obj[obj[prop]] = prop;
}
}
return new_obj;
};
var invertedMonths = invert(monthDisplay);
I saw the use of custom invert function here. There's a javascript library called lodash.js which will help you with array/object manipulation such as invert. I'd recommend going through the doc here. Your code will go from this:
to this: