You are on page 1of 1

What JavaScript Is Not

JavaScript is not Java. “Java is to JavaScript what Car is to Carpet” 2 Well, that quote
might be a little extreme, but suggests that these are two very different languages.
Java was developed at Sun Microsystems. JavaScript was developed at Netscape. Java
applications can be independent of a Web page, whereas JavaScript programs are embedded
in a Web page and must be run in a browser window.3 Java is a strongly typed language
with strict guidelines, whereas JavaScript is loosely typed and flexible. Java data
types must be declared. JavaScript types such as variables, parameters, and function
return types do not have to be declared. Java programs are compiled. JavaScript programs
are interpreted by a JavaScript engine that lives in the browser.
JavaScript is not HTML, but JavaScript code can be embedded in an HTML document
and is contained within HTML tags. JavaScript has its own syntax rules and
expects statements to be written in a certain way. JavaScript doesn’t understand
HTML, but it can contain HTML content within its statements. All of this will become
clear as we proceed.
JavaScript is not used to read or write the files on client machines with the exception
of writing to cookies (see Chapter 16, “Cookies”). It does not let you write to or store
files on the server. It does not open or close windows already opened by other applications
and it cannot read from an opened Web page that came from another server.
JavaScript is object based but not strictly object oriented because it does not support
the traditional mechanism for inheritance and classes found in object-oriented programming
languages, such as Java and C++. The terms private, protected, and public do not
apply to JavaScript methods as with Java and C++.
JavaScript is not the only language that can be embedded in an application. VBScript,
for example, developed by Microsoft, is similar to JavaScript, but is embedded in Microsoft’s
Internet Explorer.

You might also like