JavaScript QuickStart: What Is JavaScript? : Page 2

JavaScript. It has all the hallmarks of "flavor of the month"its name is appearing everywhere and there's panting and foaming at the mouth over learning to use it. So what is it? And why should you care?

by DEVX Staff

Jan 1, 2000

Page 2 of 4

JavaScript vs. Java
The number one area of confusion about JavaScript is thinking that it is the thing same as Java.

No. Nope. Not the same.

They two are different creatures that share only an object philosophy and a similiar name.

Java is a compiled programming language, comparable to languages such C, C++, or Pascal.

Everything from small applets (tiny programs) to entire shrink-wrapped applications are being created in Java. Many in the programming world predict that Java will eventually replace C and C++ as a language of choice for application development.

JavaScript is a scripting language, ideal for small programs used only from within Web browsers. A JavaScript script can't run alone, without the browser, the way a Java program does.

JScript is Microsoft's implementation of JavaScript.

A Little History...
In typical Web fashion, the evolutionary process of JavaScript has taken a somewhat lumpy path. When JavaScript started out life at Netscape, it was called LiveScript and its goal was to allow dynamic ("live") changes of Web pages and communication between the Web browser and plug-in applications ... such as Java. Java was hot and marketable, so in late 1995 Netscape got permission from Sun, the creators of Java, to use the word "Java" and Livescript became the *catchier* JavaScript.

But along the way, JavaScript took on a life of its own. It was easier for non-programmers to learn than Java. It could add a lot of interactivity with little overhead. Like HTML code, JavaScript is contained within the HTML text file, so it can be easily added and modified. It became hot itself. And so now there's a move afoot to standardize JavaScript.

More Than You Might Want to Know, But...
Within the Web environment, the most common use of Java is to build applets, small programs that launch automatically from within a Web page. When the Web page loads, these applets are launched and begin to run on your local computer. While the applet runs, your browser sits quietly by.

On the plus side, running a Java applet doesn't consume server time. It makes it possible for small, self-contained programs to be delivered via the Web, but run locally on individual computers. However, downloading Java applets has some people concerned about security; in corporate environments, Information Systems departments sometimes set up procedures to screen out external Java applets and prevent them from being downloaded. These IS managers fear (rightly or wrongly) that the applet could infect the system or be, in some way, a threat to the network.

JavaScript, on the other hand, is attractive to Web developers because it is a scripting language rather than a self-executing program. The code is typically placed directly in the Web pagein fact, it requires a Web browser in order to run and it is designed to be fully-integrated with the browser. Because the JavaScript is physically located within the Web page, firewalls can't screen it out (although individual browsers can be configured to turn off JavaScript).