4. Comparing Java with JavaScript

  1. JavaScript supports closures; Java only supports a limited version of closures for anonymous classes and "lambdas".

  2. JavaScript classes can be redefined at runtime, immediately affecting all objects that instantiate the class. Java classes cannot be redefined in such a way.

  3. JavaScript allows methods in an object to be redefined independently of its class; methods in a Java object are tied to its class, and cannot be redefined at runtime.