I have a web page that loads two javascript modules:<script type="module>. I want, in one module to check if a function exists in the other. I can see no way to do this. The firefox debugger identifies the functions in the module where I'm checking, but I can find no way to examine the functions in the other. Is there some way to do this?
Add a comment
|
1 Answer
Each module has its own top-level scope. In other words, top-level variables and functions from a module are not seen in other scripts.
1 Comment
Nicole
Damn! I had suspected that this was the case for quite a while, but this is the first time I've seen an article about it. I wonder if this will ever be addressed by the W3C or whoever is responsible. Thank you, Dr. Nugent, for your, quick, complete and very useful reply.