How to know which file called index.js?

I’ve three html files a.html,b.html & c.html

All of them call index.js.

Inside index.js, I’m importing a variable from a.js,b.js & c.js. Based on which html file called index.js , I want to use the variable from the corresponding js file inside index.js.

pic

It’s not possible for me to remove index.js as it contains logic, which is needed for some other tasks.