Execution environment (Definition)

The environment in which a script is executed.

The execution environment is where the script is run. In compiled languages, the translation environment and the execution environment may not be the same. JavaScript is interpreted and therefore the translation and execution environments are one and the same.

However, JavaScript can be transported across a network and may be executed in a server and then transferred to a client and executed there.

This means that the execution environment may change from time to time. The script should be aware of the context and environment it is being executed in if it needs to be portable in this way.

Future developments suggest that JavaScript may be available in hosted environments that will require the script to be delivered in a compact form. Indeed, some JavaScript interpreters are written in Java and decompose the script to Java byte-codes before executing them in the Java Virtual Machine. If these tokenized JavaScripts were transmitted to a remote machine, then JavaScript could be considered to be a compiled (or semi-compiled) language. In that case the translation environment would be different to the execution environment.

See also:argc parameter, argv parameter, Environment, Garbage collection, Host environment, main() function, Script termination

Cross-references:

Wrox Instant JavaScript - page - 5