I have some browser sniffer code using the function detect.js. It works fine when not added to my project. Still, when I try to compile the JavaScript and add it to app.js, I get an error in the console at the first line below, refreshing the browser and detecting the browser version.
Uncaught ReferenceError: forEach is not defined.
// Each Utility var each = forEach = function (obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { iterator.call(context, obj[i], i, obj); } } else { for (var key in obj) { if (_.has(obj, key)) { iterator.call(context, obj[key], key, obj); } } } }; It seems like compiling the JavaScript is doing something to it. Any suggestions?

window.forEach = function() { ...instead.