I have a variable named siteURL which is set using window.location.href.
I'm wanting to trim off the the last 10 characters which in this case is ...index.html.
var siteURL = window.location.href;
if (siteURL.endsWith('index.html')) {
siteURL.substring(0, siteURL.length - 10);
}
//log the output
console.log(siteURL);
I'm trying this but it doesn't seem to be removing the last 10 character. Does anyone know where I'm going wrong and could point me in the right direction?