var mainPageLocation = document.location.pathname;
if (mainPageLocation.indexOf('/en/') !== -1) {
console.info('Page has en path');
}
Или на ES6:
const mainPageLocation = document.location.pathname;
if (mainPageLocation.includes('/en/')) {
console.info('Page has en path');
}