Messing with the string endsWith functionality in ES6