I have both es5-shim.js and underscore.js in my JavaScript project.
es5-shim.js just add some javascript native functions like reduce
and some
on arrays for Internet Explorer and some old browsers. underscore.js add the same thing (but with a different syntax) and many more thing (utility functions on objects and arrays).
But, if the functions added by es5-shim exists, underscore.js use them.
So, on a "recent" browser like Firefox or Chrome, underscore.js use the native functions of the browser. I think it's better than a pure javascript function. But on Internet Explorer, underscore.js use the es5-shim functions. If I remove es5-shim.js, underscore.js use its own functions.
Any advice on that ? Should i remove es5-shim from my project and only use underscore.js ? Or should i let underscore.js use es5-shim's functions ?
es5-shim, as you rightly mentioned, adds some JavaScript functions like map, reduce, some and forEach on Array if the browser's JavaScript engine is not ES5 compatible. Underscore.js adds utility methods similar to the above (and more) within the "_" namespace. So, in this case, using both in the same application is redundant.
That said, es5-shim, adds a few more functions like Date.now, Date.toJSON, Function.bind, String.trim (and more) some which don't have direct equivalents in Underscore.js. For example Underscore does provide _.bind and _.bindAll that is equivalent to Function.bind, but Underscore.js does not provide Date.now and Date.toJSON.
So, if you use these additional methods provided by es5-shim you can stay with both es5-shim and Underscore.js in your application. But, if you are not using these additional methods, then using es5-shim would just be an unnecessary increase in application size and waste of bandwidth.