I cannot get Javascript to filter a dynamically created array, although it filters a static array fine. Code block #1 works (static array), code block #2 doesn\'t (dynamically
_eventsArray
in your second example is an HTMLCollection not a JS Array. You can convert it like the following:
function getRowCalendarEvents (_eventsArray,_unitValue) {
var arr = [].slice.call(_eventsArray);
return arr.filter(function(_calendarEvent) {
return _calendarEvent.unit == _unitValue;
});
}