get the last parth of url js code example Example: javascript get last url segment console.log(this.href.substring(this.href.lastIndexOf('/') + 1));