What is the solution to make this code work in IE?
var tEvents = eventsJSON.response.Events.filter(function (val, index, array) {
return val.participating_region.indexOf(varRegion) !== -1;
});
totalEvents = tEvents.length;
I am aware of the issue with .includes(), but I am unsure how to use .indexOf() instead.
Complete code:
var varRegion = $('body').data('region');
var eventsJSON = null;
var totalEvents;
var virtualEvents;
$.ajax({
'url': '/services/getAllEvents',
'dataType': 'json',
'success': function (data) {
eventsJSON = data;
parseJSONevents();
}
});
function parseJSONevents() {
var tEvents = eventsJSON.response.Events.filter(function (val, index, array) {
return val.participating_region.indexOf(varRegion) !== -1;
});
totalEvents = tEvents.length;
$('.in-person-events').text(totalEvents);
return eventsJSON;
};