JavaScript resides inside the HTML file, and can provide levels of interactivity far beyond typically flat HTML pages. The JavaScript language resembles Java, but without Java's static typing and strong type checking. JavaScript supports most of Java's expression syntax and basic control flow constructs. JavaScript has a simple instance-based object model that still provides significant capabilities. JavaScript also supports functions, again without any special declarative requirements.
Functions can be properties of objects, executing as loosely typed methods.
JavaScript complements Java by exposing useful properties of Java applets to script authors. JavaScript statements can get and set exposed properties to query the state or alter the performance of an applet or plug-in. Java is an extension language designed, in particular, for fast execution. Java programs consist exclusively of classes and their methods. Java's requirements for declaring classes, writing methods, and ensuring type safety make programming more complex than JavaScript authoring.