Arrow Functions and Internet Explorer
I had deployed a piece of code that was being tested on IE11. When I looked at the console, I saw that it was complaining about the syntax of arrow functions. It turns out arrow functions are not supported in IE. I hadn’t written arrow functions myself, so I had to look it up and port the snippet back to vanilla JavaScript.
Before
var groupedByYear = _(sample_data)
.groupBy('year')
.map((objs, key) => ({
year: key,
count: _.sumBy(objs, 'count')
}))
.value()
After
var groupedByYear = _(sample_data)
.groupBy('year')
.map(function(objs, key) {
return {
year: key,
count: _.sumBy(objs, 'count')
}
})
.value()