How to make file not open to public but javascript file under WordPress folder can load it

How to make file not open to public but javascript file under WordPress folder can load it