JavaScript (often abbreviated as JS) is a structured, high-level scripting structured programming language with weak dynamic typing and multiparadigm (prototypes, object-oriented, imperative, and functional). Along with HTML and CSS, JavaScript is one of the top three technologies in the World Wide Web. JavaScript enables interactive web pages and is therefore an essential part of web applications. The vast majority of websites use it, and all major browsers have a dedicated JavaScript engine to run it.

Paradigm Multiparadigm

  • functional
  • Imperative
  • object-oriented
Arising in December 4, 1995
Latest version ECMAScript 2022 (June 2022)
Created by Brendan Eich
Typing style
  • dynamics
  • weak
Key implementations
  • V8
  • JavaScriptCore
  • Spidermonkey
Dialects: TypeScript
Influenced by
  • Self
  • C
  • Lisp
  • Scheme
  • Perl
  • Python
  • Java
  • ActionScript
  • CoffeeScript
  • Dart
  • JScript
  • JScript .NET
  • Objective-J
  • Zig
File extension:
  • .js
  • .mjs

It is currently the main language for client-side programming in web browsers. It is also widely used on the server side through environments such as node.js.

As a multiparadigm language, JavaScript supports event-oriented, functional, and imperative programming styles (including object-oriented and prototype-based), presenting features such as closures and high-order functions commonly unavailable in popular languages such as Java and C++. It has APIs for working with text, arrays, dates, regular expressions, and the DOM, but the language itself does not include any I/O, such as network installations, storage, or graphics, remeasure in the host environment in which it is embedded.

It was originally implemented as part of web browsers so that scripts could run on the client side and interact with the user without the need for this script to go through the server, controlling the browser, performing asynchronous communication, and changing the content of the displayed document, but JavaScript engines are now embedded in many other types of host software, including on servers and web databases and non-Web programs, such as word and PDF processors, and run-time environments that make JavaScript available for writing mobile and desktop applications, including desktop widgets.

The terms Vanilla JavaScript and Vanilla JS refer to JavaScript not extended by any additional structure or library. Scripts written in Vanilla JS are simple JavaScript code.

Although there are similarities between JavaScript and Java, including the language name, syntax, and its default libraries, the two languages are distinct and differ greatly in design; JavaScript was influenced by programming languages such as Self and Scheme.

It is based on ECMAScript, standardized by Ecma International in the specifications ECMA-262 and ISO/IEC 16262.

History of JavaScript

Start in Netscape

In 1993, the National Center for Supercomputing Applications (NCSA), a unit of the University of Illinois at Urbana-Champaign, launched NCSA Mosaic, the first popular web graphics browser, which played an important role in expanding the growth of the nascent World Wide Web beyond the NeXTSTEP niche where the World Wide Web had formed three years earlier. In 1994, a company called Mosaic Communications was founded in Mountain View, California, and employed many of the original authors of NCSA Mosaic to create Mosaic Netscape. However, you did not intentionally share any code with NCSA Mosaic. The company’s internal browser codename was Mozilla, a junction of “Mosaic and Godzilla”.

The first version of the web browser, Mosaic Netscape 0.9, was released in late 1994. In four months, it had already conquered three-quarters of the browser market and became the main web browser in the 1990s. To avoid trademark ownership issues with NCSA, the browser was later renamed Netscape Navigator in the same year, and the company took the name Netscape Communications. Netscape Communications realized that the Web needed to become more dynamic. Marc Andreessen, the company’s founder, believed that HTML needed a “glue language” that was easy to use by web designers and part-time programmers to assemble components such as images and plugins, where code could be written directly on the Web.

In 1995, Netscape Communications recruited Brendan Eich to incorporate the Scheme programming language into its Netscape Navigator. Before it could begin, Netscape Communications collaborated with Sun Microsystems to include Netscape Navigator Sun, Java, in the more static programming language, Java, in order to compete with Microsoft for the adoption of web technologies and platforms. Netscape Communications then decided that the scripting language they wanted to create would complement Java and should have a similar syntax, which excluded the adoption of other languages such as Perl, Python, TCL, or Scheme. To defend the javascript idea against competing proposals, the company needed a prototype. Eich wrote one in 10 days in May 1995.

Although it was developed under the mocha name, the language was officially called LiveScript when it was released in beta versions of Netscape Navigator 2.0 in September 1995, but was renamed JavaScript when it was released in Netscape Navigator 2.0 beta on 3 December. The final choice of name caused confusion, giving the impression that the language was a derivation of the Java programming language, and the choice was characterized as a marketing ploy by Netscape to give JavaScript the status of the fashion language, Java.

There is a common misconception that JavaScript was influenced by a Web page scripting language developed by Nombas called Cmm (not to be confused with C later – created in 1997). Brendan Eich, however, had never heard of Cmm before creating LiveScript. Nombas released their web page scripts embedded in Netscape, although the web page script was not a new concept, as shown by the ViolaWWW web browser. Nombas later went on to offer JavaScript instead of Cmm in his ScriptEase product and was part of the TC39 group that standardized ECMAScript.

JavaScript Back-end

In December 1995, shortly after releasing JavaScript for browsers, Netscape introduced an implementation of the language for server-side scripting with Netscape Enterprise Server.

Since 1996, the IIS Web server has supported the implementation of JavaScript – JScript server-side – on ASP and .NET pages.

Since the mid-2000s, additional server-side JavaScript implementations such as Node.js 2009, have been introduced.

TypeScript is a programming language that adds typing to JavaScript and is popular for use in the backend.

Adoption by Microsoft

Microsoft scripting technologies, including VBScript and JScript, were released in 1996. JScript, a reverse engineering implementation of Netscape’s JavaScript, was part of Internet Explorer 3. JScript was also available for server scripts on the Internet Information Server. Internet Explorer 3 also included Microsoft’s first support for CSS and multiple extensions for HTML, but in each case the implementation was noticeably different from the one found in Netscape Navigator at the time.

These differences made it difficult for designers and programmers to make a single website work well in both browsers, leading to the use of the “best viewed in Netscape” and “best viewed in Internet Explorer” logos that characterized these early years of browser wars. JavaScript has begun to acquire a reputation for being one of the obstacles to a cross-platform, standards-based web. Some developers took on the difficult task of trying to get their sites to work on both major browsers, but many couldn’t afford it over time. With the release of Internet Explorer 4, Microsoft introduced the concept of Dynamic HTML, but differences in language implementations and in the different and proprietary Document Object Templates remained and were obstacles to the widespread adoption of JavaScript on the Web.


In November 1996, Netscape submitted JavaScript to ECMA International to create a standard specification, which other browser vendors could implement based on work done on Netscape. This led to the official release of the ECMAScript language specification published in the first edition of the ECMA-262 standard in June 1997, with JavaScript being the best-known of implementations. ActionScript and JScript were other well-known implementations of ECMAScript.

The launch of ECMAScript 2 in June 1998 continued the pattern process cycle, according to some modifications of the international ISO/IEC 16262 standard. ECMAScript 3 was released in December 1999 and is the modern baseline for JavaScript. The original work of ECMAScript 4 led by Waldemar Horwat (then on Netscape, now on Google) began in 2000. Microsoft initially participated in and implemented some proposals in its JScript .NET language.

Over time, it became clear that Microsoft had no intention of cooperating or implementing the appropriate JavaScript in Internet Explorer, even if they did not have a competing proposal and had a partial (and divergent) implementation at this point) on the .NET server side. Then, in 2003, the original work of ECMAScript 4 was disabled.

The next big event was in 2005, with two major events in javascript history. First, Brendan Eich and Mozilla rejoined Ecma International as a non-profit member and began working on ECMAScript for XML (E4X), the ECMA-357 standard, which came from former Microsoft employees at BEA Systems (originally acquired as Crossgain). This led to working in conjunction with Macromedia (later acquired by Adobe Systems), which was implementing E4X in ActionScript 3 (ActionScript 3 was a fork of the original ECMAScript 4).

Thus, together with Macromedia, the work was restarted in ECMAScript 4 with the aim of standardizing what was in ActionScript 3. To this, Adobe Systems has launched ActionScript Virtual Machine 2, codenamed Tamarin, as an open-source project. But Tamarin and ActionScript 3 were too different from Web JavaScript to converge, as was done by the parties in 2007 and 2008.

There was still turbulence among the various players; Douglas Crockford — then on Yahoo! — joined forces with Microsoft in 2007 to support ECMAScript 4, which led to the effort of ECMAScript 3.1. The development of ECMAScript 4 was never completed, but this work influenced subsequent versions.

While all this was happening, open-source and developer communities began working to revolutionize what could be done with JavaScript. This community effort came in 2005, when Jesse James Garrett released a white paper in which he coined the term Ajax and described a set of technologies, of which JavaScript was the backbone, used to create Web applications where data can be loaded in the background, avoiding the need for full page reloads and leading to more dynamic applications. This resulted in a period of rebirth of javascript usage led by open source libraries and the communities that formed around them, with libraries such as Prototype, jQuery, Dojo Toolkit, MooTools, and others.

In July 2008, the different parties on both sides met in Oslo. This led to the eventual agreement in early 2009 to rename ECMAScript 3.1 to ECMAScript 5 and boost the language using a schedule that is known as Harmony. ECMAScript 5 was finally released in December 2009.

In June 2011, ECMAScript 5.1 was released to fully align with the third edition of the international ISO/IEC 16262 standard. ECMAScript 2015 was released in June 2015. ECMAScript 2016 was released in June 2016. The current version is ECMAScript 2017, released in June 2017.

Later developments

JavaScript has become one of the most popular programming languages on the web. However, many professional programmers initially discredited the language due to the perceived target audience of Web authors and other “amateurs”. The advent of Ajax returned JavaScript to the spotlight and attracted more attention from professional programming. The result was the proliferation of comprehensive frameworks and libraries, improved JavaScript programming practices, and increased use of JavaScript outside web browsers, as noted 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 primarily for developing JavaScript outside the browser.

With the emergence of single-page applications and heavy sites in JavaScript, it is increasingly being used as a build target for source compilers to source dynamic and static languages.


“JavaScript” is a trademark of Oracle Corporation in the United States. It is used under license for technology invented and implemented by Netscape Communications and current entities such as the Mozilla Foundation.

JavaScript features

The following characteristics are common to all ECMAScript-compliant implementations unless explicitly specified backwards.

Universal support

All modern and popular web browsers support JavaScript with built-in interpreters.

Imperative and Structured

JavaScript supports the structured programming syntax elements of the C language, such as if, while, switch. An exception is the issue of scope: C-style block scope is not supported. In its place, JavaScript uses role-level scope. JavaScript 1.7, however, supports block-level scope through the let command. Like C, JavaScript distinguishes between expressions and commands. A synctactic difference from C is that the line break automatically terminates the command, and the semicolon is optional at the end of a statement.


Dynamic typing

As in most scripting languages, types are associated with values, not variables. For example, the variable x could be associated with a number and later associated with a string. JavaScript supports several ways to test the type of an object, including duck typing.


JavaScript is almost entirely object-based. JavaScript objects are associative arrays , auged with prototypes. The property names of an object are strings: obj. x = 10 and obj["x"] = 10 are equivalent, the point in this example is just syntactic. Properties and their values can be added, changed, or deleted at run time. Most properties of an object (and those in its inheritance chain via prototype) can be enumerated using a repeating structure for... in. JavaScript has a small number of standard language objects such as window and document.

Run-time evaluation

JavaScript includes the eval function that can execute run language commands that are written in a string.


First-class functions

In JavaScript, functions are first-class, that is, they are objects that have properties and methods, and can be passed as arguments, assigned to variables, or returned like any other object.

Nested functions

‘Internal’ or ‘nested’ functions are functions defined within other functions. They are created each time the function containing them (external) is invoked. In addition, the scope of the outer function, including constants, local variables, and argument values, becomes part of the internal state of each object created from the internal function, even after the execution of the internal function is completed.


JavaScript allows nested functions to be created with the lexical scope at the time of their definition and has the operator () to invoke them at another time. This combination of code that can be executed outside the scope in which it was defined, with its own scope during execution, is called, within computer science, closure.



JavaScript uses prototypes instead of classes for the inheritance engine. You can simulate many class-based object orientation characteristics with prototypes.

function calcIty(b) {
  var today = new Date();
  var a = today.getFullYear();
  var age = a - b;
  return age;

Functions and methods

Unlike many object-oriented languages, there is no distinction between defining a function and defining a method in JavaScript. The distinction occurs during the function call; the function can be called as a method. When a function is called as an object’s method, the keyword this of the function is associated with that object via such an invocation.

Vendor-specific extensions

JavaScript is officially managed by the Mozilla Foundation, and new language features are added periodically. However, only a few JavaScript engines support these new features:

  • Getter and setter property functions (supported by WebKit, Gecko, Opera, ActionScript, and Rhino).
  • Conditional capture clauses.
  • Iterator protocol (adopted from Python).
  • Array and expression generator understandings (adopted from Python)
  • Appropriate block scope through let keyword
  • Destructuring of array and object (limited form of pattern matching)
  • Concise function expressions (function(args) expr
  • ECMAScript for XML (E4X), an extension that adds native XML support to ECMAScript (not supported in Firefox since version 21)

The use of JavaScript on web pages

The primary use of JavaScript is to write functions that are embedded or included in HTML pages and that interact with the Document Object Model (DOM) of the page. Some examples of this use are:

  • open a new window (dialog) with programmatic control over its size, position and attributes;
  • validate values from a form to ensure that they are acceptable before they are sent to the server;
  • change images as the mouse moves over them.

A useful window-based interface feature is a type of secondary window of the main screen, or main window, to request or display to the user certain complementary information, similar to “dialog”.

There are two types of association between a dialog window and the main window to which it is associated: “modal shape” (showModalDialog), when the opening of the flexible dialog window overlaps the main window without the need to reload the main page after using the modal, called Lightbox, blocking the interaction with the main window by fading/darkening in the background until the dialog is terminated; or “non-modal form”, in which there may be concomitant interaction in the two windows (main and dialog) without blocking the main, The most common case is modal dialog.

Because JavaScript code runs locally in the user’s browser, not on a remote server, the browser can respond to such actions quickly, making an application more responsive. In addition, JavaScript code can detect user actions that HTML alone cannot, such as individually pressed keys. Applications like Gmail take advantage of this: much of the UI logic is written in JavaScript, and JavaScript sends requests for information, such as the content sum of an e-mail, to the server. The broader trend of programming in Ajax explores this strong point in a similar way.

A JavaScript engine (also known as a JavaScript interpreter or a JavaScript implementation) interprets JavaScript source code and executes it appropriately. The first JavaScript implementation was created by Brendan Eich at Netscape Communications Corporation for Netscape Browser. The implementation, named SpiderMonkey, is implemented in C and has been updated to conform to issue 3 of the ECMA-262. The Rhino implementation, created primarily by Norris Boyd (former Netscape employee; now at Google) is a JavaScript implementation in Java. Rhino, like SpiderMonkey, conforms to the third edition of the ECMA-262.

Because JavaScript is the only language that most popular browsers support, it has become a target language for many frameworks in other languages, despite the fact that it was not designed to do so. Despite the performance limitations inherent in its dynamic nature, the increasing speed of JavaScript implementations has made it a practical intermediate language.


A minimalist example of a page according to web standards (using HTML5 syntax) that contains JavaScript can be represented by the following code:

<! DOCTYPE html><html lang="en-BR"><head><meta charset="UTF-8" /><title>Wikipedia</title><script>window. onload = function() {document. getElementById("hello"). addEventListener("click",[click", function() {alert("Welcome to Wikipedia!");

                }, false); }; </script></head><body><noscript>Your browser does not support JavaScript or it is disabled. </noscript><button id="hello">Say "hello"</button></body></html>

In the script above, we saw that there is a tag called <noscript>, it is in this HTML code because it is a means of accessibility with the client, causing its text to be rendered by the browser when JavaScript is disabled.

JavaScript compatibility

Because JavaScript runs in variable environments, an important part of testing and debugging your code is checking for compatibility between browsers.

DOM interfaces for handling web pages are not part of the ECMA standard, or javascript itself. Officially, they are defined by a W3C standardization effort; in practice, browser implementations differ from the default to one another, and not all browsers run JavaScript.

To deal with these differences, JavaScript programmers often try to write code that conforms to the common standard most browsers; if this is not possible, they try to write code ad hoc that checks for certain resources and behaves appropriately if such features are not available. In some cases, two browsers can both implement functionality with different behaviors, and programmers may find it practical to detect which browser is running and change the behavior of their scripts to suit this. Programmers can also use libraries or tools that abstract such differences between browsers.

Additionally, scripts may not work for some users. For example, a user can:

  • Use an old or rare browser with incomplete or unusual DOM support.
  • Use a browser from a PDA or mobile phone that is not able to run JavaScript.
  • Have JavaScript running disabled by security standards.

To support such users, web programmers try to create pages that are robust to agents that do not support the page’s JavaScript. In particular, a page should work regardless of the extra features that JavaScript provides. An alternative approach that many find preferable is to page itself first from basic technologies that work in all browsers, and then enhance it for users who have JavaScript.


Assuming that the user has not disabled its execution, you can use client-side JavaScript to improve the experience of a user with physical or visual impairment.

Screen readers used by blind or partially sighted people can detect the presence of JavaScript and thereby access and read the PAGE’s DOM after their scripts have run. In these cases, it is recommended that the HTML be as concise, navigable and semantically rich as possible, whether the page scripts or not. It is not recommended that the JavaScript code of a page be entirely dependent on the events coming from the mouse since users who cannot or choose not to use the mouse will not be able to reap the benefits of such code. Similarly, although hyperlinks and web forms can be navigated and operated from the keyboard, accessibility-oriented JavaScript should not require a keyboard to access such events. JavaScript relies on user device-independent events such as onfocus and onchange that are most recommended in most cases.

It is not recommended to use JavaScript in a way that is confusing or disorienting for any internet user. For example, using JavaScript to change or disable the normal functionality of a browser, such as changing the way the right-click or update event works, should be avoided. Similarly, interrupt events that the user may not be aware of reduce the user’s sense of control, as well as unexpected scripts that change the content of the page.

Often the process of making complex web pages as accessible as possible turns into a non-trivial problem, where certain decisions are the subject of debate and opinion. However, assistive technologies are constantly evolving and new recommendations and relevant information has been continuously published on the web.


JavaScript and the DOM represent a potential for malicious programmers to write scripts to run on a client via the web. Browsers are designed to contain this risk in two ways. The first is that scripts are run in a sandbox in which they can only perform internet-related actions, not general-purpose programming tasks such as creating files. The second is that scripts are limited by the same source rule: scripts from one website do not have access to information such as usernames, passwords or cookies sent from another website. Most security-related JavaScript bugs are loopholes in one of the rules.

Inter-site vulnerabilities

A common security-related problem is writing inter-site scripts, or XSS, a violation of the rule from the same source. Such vulnerabilities occur when an attacker is able to cause on a target site, such as a bank site, the inclusion of a malicious script on the web page presented to the victim. The script in this example can then access the bank’s application with victim privileges, potentially revealing classified information or transferring money without the victim’s permission.

Some browsers include partial protection against reflected XSS attacks, in which the attacker provides a URL including malicious scripting. However, even users of these sites are vulnerable to other XSS attacks, such as those where malicious code is stored in a database. Only the correct design of web applications on the server can fully prevent XSS attacks.

XSS vulnerabilities can also occur because of implementation errors by browser programmers.

Another intersite vulnerability is intersite requisition or CSRF. In CSRF, the code on an attacker’s website causes the victim’s browser to take unwanted actions by the user on a target site (such as transferring money to a bank). It works because if the target site only has cookies to authenticate requests, then requests initiated by the code on the attacker’s site will carry the same legitimate login credentials as user-initiated requests. In general, the solution for CSRF is to require an authentication value in a hidden web form field, and not only in cookies, to authenticate any request that may have lasting effects. Checking the HEADER of the HTTP Referrer can also help.

“JavaScript Hijacking” is a type of CSRF attack in which a <script> tag on the attacker’s website exploits a page on the victim’s side that returns private information such as JSON or JavaScript. Possible solutions include requiring an authentication token in the POST and GET parameters for any response that returns a private JSON (even if it has no side effects); use POST and never GET for requests that return a private JSON; and modify the response so that it cannot be used via a <script> tag (through, for example, wrapping a JSON in a JavaScript comment).

Doubtful trust (customer)

Client-server application developers must recognize that untrusted clients may be under the control of attackers. The application author cannot assume that your JavaScript code will run as intended (or at all) because any secret embedded in the code can be extracted by a particular adversary. Some implications are:

  • Site developers cannot perfectly hide how site JavaScript works because raw source code must be sent to the client. The code may be obfuscated, but obfuscation can be designed by reverse engineering.
  • JavaScript form validation provides only convenience for users, not security. If a site finds that the user has agreed to its terms of service or filters invalid characters in fields that should contain only numbers, it must do so on the server, not just on the client.
  • Scripts can be selectively disabled, so you can’t rely on JavaScript to prevent operations, such as right-clicking an image to save it.
  • It is an extremely bad practice to incorporate sensitive information, such as passwords, into JavaScript because it can be extracted by an attacker.

Dubious trust (server)

Package management systems, such as npm and Bower, are popular with JavaScript developers. Such systems allow a developer to easily manage the dependencies of their programs on the program libraries of other developers. Developers trust that library maintainers will keep them safe and up-to-date, but that’s not always the case. A vulnerability arose because of this blind trust. Trusted libraries can have new versions that cause bugs or vulnerabilities in all programs that depend on libraries. Conversely, a library can go unfixed with known vulnerabilities in nature. In a study done looking at a sample of 133 sites, the researchers found that 37% of the sites included a library with at least one known vulnerability.

The median delay between the older library version used on each site and the newest available version of this library is 1,177 days in ALEXA, and the development of some libraries still in active use ceased years ago. Another possibility is that the maintainer of a library can remove the library completely. This occurred in March 2016, when Azer Koçulu removed its npm repository. This caused all tens of thousands of programs and websites, depending on their libraries, to break down.

Browser and plug-in encoding errors

JavaScript provides an interface for a wide range of browser features, some of which may have flaws, such as buffer overflow. These failures can allow attackers to write scripts that would execute any code they want on the user’s system. This code is in no way limited to another JavaScript application. For example, an overrun buffer exploit could allow an attacker to gain access to the operating system API with superuser privileges.

These failures affected major browsers, including Firefox, Internet Explorer and Safari.

Plugins, such as video players, Adobe Flash, and the wide range of ActiveX controls enabled by default in Microsoft Internet Explorer, can also have exploitable flaws via JavaScript (such flaws have been exploited in the past).

In Windows Vista, Microsoft tried to contain the risks of errors, such as buffer overflow, by running the Internet Explorer process with limited privileges. Google Chrome confines its page renderers to its own sandbox.

Sandbox implementation errors

Web browsers are able to run JavaScript outside the sandbox, with the privileges required to, for example, create or delete files. Of course, these privileges should not be granted to Web code.

The incorrect granting of privileges to Web JavaScript played an important role in the vulnerabilities of Internet Explorer and Firefox. In Windows XP Service Pack 2, Microsoft lowered JScript privileges in Internet Explorer.

Microsoft Windows allows JavaScript source files on a computer’s hard drive to be released as general-purpose programs and without a sandbox. This makes JavaScript (such as VBScript) a theoretically viable vector for a Trojan horse, although Trojan horses in JavaScript are unusual in practice.

Hardware Vulnerabilities

In 2015, a JavaScript-based proof-of-concept implementation of a misfit attack was described in an article by security researchers.

In 2017, a browser-based JavaScript-based attack was demonstrated that could bypass the ASLR. It is called “ASLR⊕Cache” or AnC.

Examples of scripts

Simple Scripts in JavaScript

Shows a Commit and Cancel alert.
if (confirm' 'Choose 'Ok' or "Cancel" to see the corresponding message.' )  { alert ( 'You pressed the "OK" button" ); shows an  alert for answer "OK"} else {alert( 'You pressed the "Cancel" button); shows an  alert for "Cancel" answer}


JavaScript allows you to use comments in two ways:

  • Single-line comments;
  • Multi-line comments.

Examples of comments:

 This comment occupies a single line/* This commentis longer and usesmultiple lines */


Creating a simple function:

function nameDaFuncao( /*parameters*/ ) {/* code that will be executed */return/*Value returned*/; }

Object hierarchy

Constructorfunction example() {this. property = 'This is a property.',

        This. method = function() {return 'This is a method'; }}var object = new example(); Constructor instance "Example"Alerts its texts on thealert screen. property), alert(object. metodo());

Perfect Numbers

function perfectNumbers(max) {var i, j, k,perfects = []; for (i = 0; i++ < max;) {for (j = k = 0; ++j < i;) {if (i % j === 0) {k  += j; }}if (k === i) {perfects. push(k); }}return perfects. join(', '); }alert('Perfect numbers from 1 to 5000:' + perfectNumbers(5000));

Development Tools

Within JavaScript, access to a debugger becomes invaluable when developing large, non-trivial programs. There may be implementation differences between the various browsers (especially within the DOM), so it is useful to have access to a debugger for each of the browsers that a Web application is targeting.

Script debuggers are integrated into many common browsers, such as Internet Explorer, Firefox, Safari, Google Chrome, and Opera.

In addition to the Native Tools for Internet Explorer developers, three other debuggers are available for Internet Explorer: Microsoft Visual Studio has the largest number of features out of the three, closely followed by Microsoft Script Editor (a component of Microsoft Office), and finally free Microsoft script debugger. Microsoft Visual Web Developer Express provides a limited version of JavaScript debugging functionality in Microsoft Visual Studio.

Compared to Internet Explorer, Firefox has a more comprehensive set of developer tools, which also includes a debugger. Older versions of Firefox without these tools used a Firefox addon called Firebug, or the old Venkman debugger. Web Inspector WebKit includes a JavaScript debugger, which is used in Safari. A modified version called Blink DevTools is used in Google Chrome. Node.js Node Inspector, an interactive debugger that integrates with Blink DevTools. Opera includes a set of tools called Dragonfly.

In addition to native computer software, there is the online JavaScript integrated development environment (IDEs), which has debugging capabilities that are written to JavaScript and designed to run on the Web. One example is the JSLint program, developed by Douglas Crockford, who has written extensively about the language. JSLint checks JavaScript code for compliance with a set of standards and guidelines. Many libraries for JavaScript, such as three.js, provide links to demo code that can be edited by users. Demo codes are also used as a pedagogical tool by institutions such as Khan Academy to allow students to experiment with writing code in an environment where they can see the output of their programs without requiring configuration beyond the web browser.

JavaScript Versions

JavaScript was initially developed in 1996 for use in the Netscape Navigator web browser. In the same year, Microsoft released an implementation for Internet Explorer. This implementation was called JScript due to trademark issues. In 1997, the first standardized version of the language was released under the name ECMAScript in the first edition of the ECMA-262 standard.

The explicit version and opt-in of the language features were Specific to Mozilla and were removed in later versions of Firefox (at least in Firefox 59). Firefox 4 was the latest version that referred to an explicit version of JavaScript (1.8.5). With the new editions of the ECMA-262 standard, JavaScript language features are now mentioned with their initial definition in the ECMA-262 editions.

The following table of JavaScript versions with explicit versions is based on information from various trusted sources.

Version Date of publication Equivalent to Netscape
Opera Safari Google
1.0 March 1996   2.0   3.0      
1.1 August 1996   3.0          
1.2 June 1997   4.0-4.05     3    
1.3 October 1998 ECMA-262 1st edition / ECMA-262 2nd edition 4.06-4.7x   4.0 5    
1.4     Netscape
1.5 November 2000 ECMA-2623rd edition 6.0 1.0 5.5 (JScript 5.5),
6 (JScript 5.6),
7 (JScript 5.7),
8 (JScript 5.8)
7.0 3.0-5 1.0-10.0.666
1.6 November 2005 1.5 + Extra Array + Array and generic strings. + E4X   1.5        
1.7 October 2006 1.6 + Pythonic Generators + Iterators + let   2.0       28.0.1500.95
1.8 June 2008 1.7 + Generating expressions + Cloistered expressions.   3.0   11.50    
1.8.1   1.8 + Native JSON support + Minor Updates   3.5        
1.8.2 June 2009 1.8.1 + Minor updates   3.6        
1.8.5 July 2010 1.8.2 + new features for ECMA-262 5th edition compilance (latest explicit version of JavaScript)   4.0        

References (sources)