Function Scope Rules (google Apps Script Project)
If I have several files in a single Apps Script Project that have a function with the same name, how will the scope be determined? By file? By dynamic scoping? By static scoping?
Solution 1:
Looks like those declarations are all just in global scope. Subsequent definitions will overwrite the previous ones, so if you are first including Stuff.gs
, then More.gs
, then Test.gs
and are calling your function thereafter it would make sense.
The scoping in JS is static (assuming strict mode without with
and local eval
), but the global scope may be modified dynamically based on the loaded modules (and their order). This is the behaviour in the most JavaScript environments, some also have an additional file (module) scope.
Post a Comment for "Function Scope Rules (google Apps Script Project)"