One method to accomplish this is...
Object.keys(window).forEach( (key) => {
if (Array.isArray( window[key] )) {
console.log(`${key} is an array`);
}
});
It's important to note that this approach is designed for global objects specifically (i.e., objects associated with the window global variable).
Update: In response to a suggestion from @Mhmdrz_A's comment, an alternative is to create a function that evaluates an object for the presence of arrays:
function getArrayCount(object) {
let count = 0;
Object.keys(object).forEach( (key) => {
if (Array.isArray( object[key] )) {
count += 1;
}
});
return count;
}
let anyObject = { someArr: [], anotherArray: [], yetAnother: []};
console.log(getArrayCount(anyObject)); // 3
However, this method only checks the top layer of properties for the specified object. To thoroughly examine each property for nested arrays, a recursive evaluation is necessary.