Answers for "get last path segment of url in javascript"

-1

javascript get last url segment

console.log(this.href.substring(this.href.lastIndexOf('/') + 1));
Posted by: Guest on December-14-2020
0

get last path segment of url in javascript

const last_segment = window.location.pathname.split('/').pop();
Posted by: Guest on July-11-2021

Code answers related to "get last path segment of url in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language