javascript - IE ajax parsing / .includes() & .indexOf -


how can write , make work in ie?

var tevents = eventsjson.response.events.filter(function (val, index, array) {          return val.participating_region.includes(varregion); }); totalevents = tevents.length; 

i know issue .includes() , not sure how write using .indexof()

full 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.includes(varregion);     });     totalevents = tevents.length;      $('.in-person-events').text(totalevents);      return eventsjson;    }; 

return val.participating_region.indexof(varregion) > -1;

though hard tell without seeing relevant code , json response structure.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -