Interview Questions

Underscore - Object Array to Map

Use the following code to convert an object array to Map using Underscore.js

var obj_map = _.object(_.map(objArray, function(item) {
                 return [item.id, item]
        }));