Как получить последний путь от URL в JavaScript

const lastSegmentOfUrl = this.href.substring(this.href.lastIndexOf('/') + 1);
Anxious Alligator