What is JavaScript?
JavaScript first appeared in 1995, its main purpose then was to take care of input validation that were originally handled by server-side scripting language like Perl. JavaScript is the Netscape-developed object scripting language used in millions of web pages and server applications worldwide. JavaScript is a dynamic computer programming language.
It is commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed. JavaScript is classified as a prototype-based scripting language with dynamic typing and first-class functions. JavaScript is also used in server-side network programming.
There is a popular misconception about JavaScript, many people do think JavaScript is an interpreted Java, that notion is absolutely wrong. JavaScript and Java are two different programming languages, though both of them have similar Naming, Syntax and Standard libraries. JavaScript derived its syntax from C just like Java, C++, Python and other C-like languages, JavaScript semantic and design are influenced by Self and Scheme programming languages. JavaScript has been standardized in the ECMAScript language specification.
(The latest ECMA (European Computer Manufactures Association) Specification is Standard ECMAScript -262 5.1 edition (released in June 2011))
History
Birth Of WWW (World Wide Web)
The WWW (World Wide Web) project kicked off in late 80s (1989), many scientists took part in the project that was initiated by Tim Berners-lee (A British Scientist at CERN). The project was completed in the 90s, the first web page was served in late 1990 on Tim's NEXT computer (The first website hosted by Tim in 1990 was restored by CERN in year 2013 ), and by 1991 people outside CERN joined the web community.
On 30 April 1993 CERN put the World Wide Web software in the public domain. CERN made the next release available with an open license, as a more sure way to maximize its dissemination. Through these actions, making the software required to run a web server freely available, along with a basic browser and a library of code, the web was allowed to flourish.
When the World Wide Web was first created in the early 1990s all web pages were static. When you viewed a web page you saw exactly what the page was set up to show you and there was no way for you to interact with the page. This pose a big challenge to the users and the developer themselves, because they can't interact with the page.
As time passes by and the use of the web grew experts start finding means to make the web interactive. At the time internet connection was very slow, so it takes time to validate simple form using server-side script. The time taken to submit, process and validate a simple form then increased the demand for a client-side language that will handle simple processing and validation of forms before been submitted online.
Emergence of JavaScript
Brendan Eich, who worked for Netscape at the time, began developing a scripting language called Mocha, and later named LiveScript, for the release of Netscape Navigator 2 in 1995, with the intention of using it both in the browser and on the server (the server-side script was implemented in December 1994 where it was called LiveWire). Netscape entered into a development alliance with Sun Microsystems to complete the implementation of LiveScript in time for release.
Just before Netscape Navigator 2 was officially released, Netscape changed LiveScript’s name to JavaScript to capitalize on the buzz that Java was receiving from the press.
Ever since then JavaScript has become an important and one of the most popular programming languages used on the web. JavaScript success led Microsoft to adopt the program and put more resource into the development of a browser that will compete with Netscape, Internet Explorer 3 was introduced with the support for JScript (Microsoft version of JavaScript) in 1996. IIS version 3 was released in 1996 as well with support for server-side JScript. Microsoft's JavaScript implementation was later renamed JScript to avoid trademark issues.
The advent of Ajax returned JavaScript to the spotlight and brought more professional programming attention. This resulted into development of comprehensive frameworks and libraries, improved JavaScript programming practices, and increased usage of JavaScript outside of web browsers, as seen by the proliferation of server-side JavaScript platforms. In January 2009, the CommonJS project was founded with the goal of specifying a common standard library mainly for JavaScript development outside the browser.
Standardization
In November 1996, Netscape announced that it had submitted JavaScript to Ecma International for consideration as an industry standard, and subsequent work resulted in the standardized version named ECMAScript. In June 1997, Ecma International published the first edition of the ECMA-262 specification. In June 1998, some modifications were made to adapt it to the ISO/IEC-16262 standard, and the second edition was released. The third edition of ECMA-262 was published on December 1999. Development of the fourth edition of the ECMAScript standard was never completed. The fifth edition was released in December 2009. The current edition of the ECMAScript standard is 5.1, released in June 2011.
Trademark
"JavaScript" is a trademark of Oracle Corporation. It is used under license for technology invented and implemented by Netscape Communications and current entities such as the Mozilla Foundation.
Use of JavaScript
Use in Web pages
The most common use of JavaScript is to add client-side behavior to HTML pages (Dynamic HTML (DHTML)). Scripts are embedded in or included from HTML pages and interact with the Document Object Model (DOM) of the page. Some simple examples of this usage are:
- Loading new page content or submitting data to the server via AJAX without reloading the page
- Animation of page elements, fading them in and out, resizing them, moving them
- Interactive content, for example games, and playing audio and video
- Transmitting information about the user's reading habits and browsing activities to various websites (Web pages frequently do this for web analytics, ad tracking, personalization or other purposes)
- Validating input values of a web form to make sure that they are acceptable before being submitted to the server
Because JavaScript code can run locally in a user's browser (rather than on a remote server), the browser can respond to user actions quickly, making an application more responsive. Furthermore, JavaScript code can detect user actions which HTML alone cannot, such as individual keystrokes.
A JavaScript engine (also known as JavaScript interpreter or JavaScript implementation) is an interpreter that interprets JavaScript source code and executes the script accordingly.
Use outside Webpages
In addition to web browsers and servers, JavaScript interpreters are embedded in a number of tools. Each of these applications provides its own object model which provides access to the host environment. The core JavaScript language remains mostly the same in each application. It is used in;
- Embedded Scripting Language: JavaScript is used to develop plug-ins, extensions and windows gadgets and widgets.
- Designing and developing Scripting Engines
- Developing some Applications Platforms
- Developing Microcontrollers: A microcontroller (abbreviation µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals.
JavaScript and Java
Similarities:
A common misconception is that JavaScript is similar or closely related to Java. It is true that both of them have;
- C-like syntax (the C language being their most immediate common ancestor language).
- They also are both typically sandboxed (when used inside a browser)
- JavaScript was designed with Java's syntax and standard library in mind.
- Java keywords were reserved in original JavaScript
- JavaScript's standard library follows Java's naming conventions
- JavaScript's Math and Date objects are based on classes from Java 1.0
Differences:
- Java has static typing, while JavaScript's typing is dynamic.
- Java is loaded from compiled bytecode, while JavaScript is loaded as human-readable source code.
- Java's objects are class-based, while JavaScript's are prototype-based.
- Java did not support functional programming until Java 8, while JavaScript does, as it contains many features based on Scheme.
thanks...
ReplyDelete