Note: This feature is available in Web Workers.
The filename read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.
A string.
window.addEventListener("error", (ev) => {
console.log(`The error occur in file: ${ev.filename}`);
});