`+= (appLocation.substring(appLocation.length - 1) === '/' ? '' : '/'`

No point in searching for it when we only care if it's at the end.