Nicole
Nicole

Reputation: 729

Check if function exists in other javascript module

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?

Upvotes: 0

Views: 266

Answers (1)

drnugent
drnugent

Reputation: 1545

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.

Upvotes: 1

Related Questions