Check a string for 2 values
You can simplify it by using Array.prototype.some method and lazy evaluation of &amp;&amp; operator

const pageTypes = ['dashboard', 'klantenkaart', 'complexkaart', 'objectkaart', 'collegakaart'];
const subTypes = ['overzicht', 'tijdlijn', 'contracten', 'financieel', 'mededelingen'];

function isOnPageWithFilter(currentUrl) {
    return pageTypes.some(x =&gt; currentUrl.includes(x)) &amp;&amp; subTypes.some(x =&gt; currentUrl.includes(x));
}

console.log(isOnPageWithFilter('foobar.com?dashboard')); // false
console.log(isOnPageWithFilter('foobar.com?dashboard&amp;overzicht')); // true

```