check the doc name in javascript

JavaScript
var path = window.location.pathname;
var page = path.split("/").pop();
console.log( page );
Source

Also in JavaScript: