Javascript


Definition of JavaScript in Network Encyclopedia.

What is JavaScript?

Javascript is a cross-platform, object-based scripting language that is similar to C but simpler in syntax. JavaScript was developed by Netscape Communications and built into the Netscape Navigator Web browser version 2.0 and later. JavaScript enables Web developers to produce Web pages with dynamic functionality such as animated graphics, browser detection, cookies, scrolling text, form handlers, and authentication without having to write or invoke Common Gateway Interface (CGI) applications. JavaScript can be used to develop both client and server applications, but it is usually run on the client Web browser.

JavaScript
JavaScript

How it works

JavaScript scripts are placed in standard Hypertext Markup Language (HTML) files using special tags. Here is a simple example:

<HTML>
<HEAD><TITLE>Javascript Test</TITLE></HEAD>
<BODY>
<H1>Knock Knock</H1>
<SCRIPT LANGUAGE="JavaScript">
alert("Who's there?");
</SCRIPT>
</BODY>
</HTML>

The <SCRIPT> and </SCRIPT> tags identify and contain the actual JavaScript script. When this page is loaded into a Web browser such as Netscape Navigator version 3.0, the browser reads the script and interprets it, causing an alert dialog box to be displayed with the message “JavaScript Alert: Who’s there?” and an OK button that closes the dialog box when clicked.

The Web Page Triad

When you consider the components that make up a web page, JavaScript forms the third component of the triad, HTML and CSS being the other two. HTML describes the page, including the text, graphics, etc. CSS is used to control and customize the look of the web page, including the colors, fonts, etc. JavaScript is used to add a dynamic component to the web page and make most elements on the page programmable.

JavaScript / HTML / CSS
JavaScript / HTML / CSS

History of JavaScript

JavaScript was created by Brendan Eich in 1995 during his time at Netscape Communications inspired by Java (from Sun).

In late 1995, when Microsoft cottoned-on to the competitive threat the Web posed, the Internet Explorer project was started in an all-out attempt to wrestle control of the emerging platform from Netscape.
In so doing Microsoft became a mortal threat, compelling Netscape to respond. First, they started a standardization process to prevent Microsoft gaining control of the JavaScript language. Second, they partnered with Sun to leverage their shared interest in breaking the Microsoft monopoly.

Sun began development of Java in 1990 in an attempt to write a language for “smart appliances”. This approach floundered and in 1994, Sun regrouped and set sights on the Web as the delivery platform of choice.

So the Netscape/Sun partnership meant Sun acquired the use of a competitive browser and a delivery system for their strategic technology.
Netscape, on the other hand found a powerful ally against Microsoft. They also aimed to out-manoeuvre Microsoft by being the official browser of the highly anticipated platform that was Java.

Brendan Eich has said that with Sun on board, they decided to surf the tidal wave of hype surrounding Java and position JavaScript as the companion language to Java, in the same way, Visual Basic was to C++. So the name was a straightforward marketing ploy to gain acceptance.

Netscape’s Mocha (later JavaScript) aimed to turn the web into a full-blown application platform. Furthermore, when used together with their LiveWire application server product, it would enable isomorphic development, with the same language used on both client and server.

If this sounds familiar, it is because this was exactly what Sun was attempting to pull off with Java. At the time, however, the Web was very limited when compared to Java; for example, drawing pixels was not possible in JavaScript as it is now with canvas. So Sun (erroneously, I believe) never saw the language as a competitor and the alliance held.

Unfortunately for JavaScript, its early market positioning outlived its usefulness and later became a brake on market acceptance as it emerged as a viable technology in its own right.

So JavaScript was conceived as a scripting language for the Web for both client and server side. It was then quickly re-positioned as a Web “companion” for Java.

The unique circumstances of the birth of the language, including:

  • the aforementioned marketing ploy,
  • time-compressed initial development,
  • a prejudice that development for the Web was not “serious”,
  • the ubiquitous and “unbreakable” deployment environment (the Web), and
  • the inclusion of language design elements unfamiliar to most developers

…led to a years-long period of misunderstanding, scorn and, yes, even hatred for the language. In the late 1990s and early 2000s even the authors of some books on JavaScript didn’t understand the fundamental elements of the language.

Douglas Crockford was one of the pioneers of the rediscovery of the language. And the importance of his invention of the JSON data format using a subset of JavaScript syntax should not be underestimated. During the 2000s mindshare slowly shifted to view JavaScript as a serious language: a critical mass of developers emerged who understood the language.

However, the “outsider status” of JavaScript continues to reverberate. Early design choices like automatic semicolon insertion (ASI), the event loop, lack of classes, unusual inheritance (prototypical) and type coercion are laughed at by people who have not taken the time to understand the thinking behind them.

NOTE


JavaScript is not the same as Java, which is an object-oriented programming language. A syntactically similar scripting language called JScript is supported on Microsoft Internet Explorer.

See also:

Editor

Articles posted after being checked by editors.

Recent Content

link to Telnet

Telnet

Telnet is a standard TCP/IP protocol for running programs on remote hosts. The term “telnet” also refers to the software (client or server component) that implements this protocol on a particular platform or system.