The accepted answer helps the OP in a specific case.
To answer a question defined in title and tags, that is to find a last modified date of a file by its URI using JavaScript, we can use an example from MDN:
function getHeaderTime() {
console.log(this.getResponseHeader("Last-Modified")); // A valid GMTString date or null
}
const req = new XMLHttpRequest();
req.open(
"HEAD", // use HEAD when you only need the headers
"your-page.html",
);
req.onload = getHeaderTime;
req.send();