I have code that gathers page elements by type - something like:
// Create arrays of page element IDs.
let pageElementIds = $w('Page').children;
function findImageElementIds(element) {
let regex = /imTag/;
return regex.test(element.id);
}
let imageElementIds = pageElementIds.filter(findImageElementIds);
This code works perfectly fine in Firefox, yet when I try to run it in Chrome, Edge, or Vivaldi, I get a series of console errors that seem to boil down to:
Typerrror: Cannot read property 'filter' of undefined.
Given that the array filter method is supported by all browsers, I can only assume that the issue lies with the way that $w(‘Page’) is being interpreted. Can anyone shed light on what might be going on here? The fact the code works perfectly in Firefox but none of the other browsers really has me confused.