HOME

TheInfoList




JavaScript (), often abbreviated JS, is a
programming language A programming language is a formal language In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calcu ...

programming language
that is one of the core technologies of the
World Wide Web The World Wide Web (WWW), commonly known as the Web, is an information system An information system (IS) is a formal, sociotechnical Sociotechnical systems (STS) in organizational development is an approach to complex organizational ...
, alongside
HTML The HyperText Markup Language, or HTML is the standard markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntacticall ...

HTML
and
CSS #REDIRECT CSS #REDIRECT CSS Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation Introduction A presentation conveys information from a speaker to an audience. Presentations are typically demonst ...

CSS
. Over 97% of
website A website (also written as web site) is a collection of web page A web page (or webpage) is a hypertext File:Douglas Engelbart in 2008.jpg, Douglas Engelbart in 2009, at the 40th anniversary celebrations of "The Mother of All Demos" i ...

website
s use JavaScript on the client side for
web page A web page (or webpage) is a hypertext Hypertext is text displayed on a or other with references () to other text that the reader can immediately access. Hypertext documents are interconnected by hyperlinks, which are typically acti ...

web page
behavior, often incorporating third-party
libraries A library is a collection of materials, books or media that are easily accessible for use and not just for display purposes. It is responsible for housing updated information in order to meet the user's needs on a daily basis. A library provi ...
. All major
web browser A web browser (commonly referred to as a browser) is application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typical ...

web browser
s have a dedicated
JavaScript engine A JavaScript engine is a computer program A computer program is a collection of instructions that can be executed by a computer to perform a specific task. A computer program is usually written by a computer programmer in a programming lang ...
to execute the
code In communication Communication (from Latin Latin (, or , ) is a classical language A classical language is a language A language is a structured system of communication Communication (from Latin ''communicare'', mean ...

code
on users' devices. JavaScript is a
high-level High-level and low-level, as technical terms, are used to classify, describe and point to specific Objective (goal), goals of a systematic operation; and are applied in a wide range of contexts, such as, for instance, in domains as widely varied as ...
, often just-in-time compiled language that conforms to the
ECMAScript ECMAScript () (or ES) is a JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds o ...
standard. It has
dynamic typing In programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming languages are used in computer programming to i ...
, prototype-based
object-orientation{{Broad-concept article Object-oriented or object-orientation is a software engineering concept, in which concepts are represented as " objects". Object-oriented topics include: * Object-oriented analysis and design * Object-oriented designObject-o ...
, and
first-class function In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algorit ...
s. It is
multi-paradigm Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms. Some paradigms are concerned mainly with implications for the execution model of the language, suc ...
, supporting event-driven,
functional Functional may refer to: * Movements in architecture: ** Functionalism (architecture) In architecture File:Plan d'exécution du second étage de l'hôtel de Brionne (dessin) De Cotte 2503c – Gallica 2011 (adjusted).jpg, upright=1.45, alt=Pl ...
, and
imperative Imperative may refer to: *Imperative mood, a grammatical mood (or mode) expressing commands, direct requests, and prohibitions *Imperative programming, a programming paradigm in computer science *Imperative logic *Imperative (film), ''Imperative'' ...
programming style Programming style, also known as code style, is a set of rules or guidelines used when writing the source code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes th ...
s. It has
application programming interface In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and so ...
s (APIs) for working with text, dates,
regular expression A regular expression (shortened as regex or regexp; also referred to as rational expression) is a sequence of that specifies a ''search ''. Usually such patterns are used by s for "find" or "find and replace" operations on , or for input val ...
s, standard
data structure In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of ...

data structure
s, and the
Document Object Model The Document Object Model (DOM) is a cross-platform In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and dev ...
(DOM). The ECMAScript standard does not include any
input/output In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algorithm) for calculating the greatest commo ...
(I/O), such as networking, storage, or
graphics Graphics () are visual The visual system comprises the sensory organ A sense is a biological system A biological system is a complex network which connects several biologically relevant entities. Biological organization spans several s ...

graphics
facilities. In practice, the web browser or other
runtime system In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, gener ...
provides JavaScript APIs for I/O. JavaScript engines were originally used only in web browsers, but are now core components of some servers and a variety of
applications Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a co ...
. The most popular runtime system for this usage is
Node.js Node.js is an open-source, cross-platform In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of ...
. Although
Java Java ( id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 147.7 million people, Java is the world's List of ...
and JavaScript are similar in name,
syntax In linguistics Linguistics is the scientific study of language, meaning that it is a comprehensive, systematic, objective, and precise study of language. Linguistics encompasses the analysis of every aspect of language, as well as the ...
, and respective standard libraries, the two languages are distinct and differ greatly in design.


History


Creation at Netscape

The first
web browser A web browser (commonly referred to as a browser) is application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typical ...

web browser
with a
graphical user interface The graphical user interface (GUI "UI" by itself is still usually pronounced . or ) is a form of user interface In the industrial design Industrial design is a process of design A design is a plan or specification for the construction ...
,
Mosaic A mosaic is a pattern or image made of small regular or irregular pieces of colored stone, glass or ceramic, held in place by plaster/mortar, and covering a surface. Mosaics are often used as floor and wall decoration, and were particularly pop ...
, was released in 1993. Accessible to non-technical people, it played a prominent role in the rapid growth of the nascent
World Wide Web The World Wide Web (WWW), commonly known as the Web, is an information system An information system (IS) is a formal, sociotechnical Sociotechnical systems (STS) in organizational development is an approach to complex organizational ...
. The lead developers of Mosaic then founded the
Netscape Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California Mountain View is a city in Santa Clara County, California ...

Netscape
corporation, which released a more polished browser,
Netscape Navigator Netscape Navigator was a proprietary web browser A web browser (commonly referred to as a browser) is application software for accessing the World Wide Web upright=1.35, A global map of the web index for countries in 2014 The World ...
, in 1994. This quickly became the most-used. During these formative years of the Web,
web page A web page (or webpage) is a hypertext Hypertext is text displayed on a or other with references () to other text that the reader can immediately access. Hypertext documents are interconnected by hyperlinks, which are typically acti ...

web page
s could only be static, lacking the capability for dynamic behavior after the page was loaded in the browser. There was a desire in the burgeoning web development scene to remove this limitation, so in 1995, Netscape decided to add a
scripting language A scripting language or script language is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming language ...
to Navigator. They pursued two routes to achieve this: collaborating with
Sun Microsystems Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java (programming language), Java programming language, the Solaris ...
to embed the
Java Java ( id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 147.7 million people, Java is the world's List of ...
programming language A programming language is a formal language In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calcu ...

programming language
, while also hiring
Brendan Eich Brendan Eich (; born July 4, 1961) is an American technologist and creator of the JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set archit ...
to embed the Scheme language. Netscape management soon decided that the best option was for Eich to devise a new language, with syntax similar to Java and less like Scheme or other extant scripting languages. Although the new language and its interpreter implementation were called LiveScript when first shipped as part of a Navigator
beta Beta (, ; uppercase , lowercase , or ; grc, βῆτα, bē̂ta or ell, βήτα, víta) is the second letter of the . In the system of Greek numerals it has a value of 2. In , beta represented the . In , it represents the (while in foreig ...
in September 1995, the name was changed to JavaScript for the official release in December. The choice of the JavaScript name has caused confusion, implying that it is directly related to Java. At the time, the
dot-com boom The dot-com bubble (also known as the dot-com boom, the tech bubble, and the Internet bubble) was a stock market bubble caused by excessive speculation of Internet-related companies in the late 1990s, a period of massive growth in the use and a ...
had begun and Java was the hot new language, so Eich considered the JavaScript name a marketing ploy by Netscape.


Adoption by Microsoft

Microsoft Microsoft Corporation is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multination ...

Microsoft
debuted
Internet Explorer Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, (from August 16, 1995 to March 30, 2021) commonly abbreviated IE or MSIE) is a discontinued series of s developed by and included in the line of s, starti ...
in 1995, leading to a browser war with Netscape. On the JavaScript front, Microsoft
reverse-engineered Reverse engineering (also known as backwards engineering or back engineering) is a process or method through the application of which one attempts to understand through deductive reasoning Deductive reasoning, also deductive logic, is the process ...
the Navigator interpreter to create its own, called
JScript JScript is Microsoft's dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer. JScript is implemented as an Active Scripting engine. This means that it can be "plugged in" to OLE Automation applications that support Ac ...
. JScript was first released in 1996, alongside initial support for
CSS #REDIRECT CSS #REDIRECT CSS Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation Introduction A presentation conveys information from a speaker to an audience. Presentations are typically demonst ...

CSS
and extensions to
HTML The HyperText Markup Language, or HTML is the standard markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntacticall ...

HTML
. Each of these implementations was noticeably different from their counterparts in Navigator. These differences made it difficult for developers to make their websites work well in both browsers, leading to widespread use of "best viewed in Netscape" and "best viewed in Internet Explorer" logos for several years.


The rise of JScript

In November 1996,
Netscape Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California Mountain View is a city in Santa Clara County, California ...

Netscape
submitted JavaScript to
Ecma International Ecma International () is a nonprofit A nonprofit organization (NPO), also known as a non-business entity, not-for-profit organization, or nonprofit institution, is a legal entity organized and operated for a collective, public or social ben ...
, as the starting point for a standard specification that all browser vendors could conform to. This led to the official release of the first
ECMAScript ECMAScript () (or ES) is a JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds o ...
language specification in June 1997. The standards process continued for a few years, with the release of ECMAScript 2 in June 1998 and ECMAScript 3 in December 1999. Work on ECMAScript 4 began in 2000. Meanwhile,
Microsoft Microsoft Corporation is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multination ...

Microsoft
gained an increasingly dominant position in the browser market. By the early 2000s, Internet Explorer's market share reached 95%. This meant that
JScript JScript is Microsoft's dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer. JScript is implemented as an Active Scripting engine. This means that it can be "plugged in" to OLE Automation applications that support Ac ...
became the de facto standard for
client-side scripting Client-side refers to operations that are performed by the client in a client–server relationship in a computer network A computer network is a group of computers that use a set of common communication protocols over digital signal, digita ...
on the Web. Microsoft initially participated in the standards process and implemented some proposals in its JScript language, but eventually it stopped collaborating on Ecma work. Thus ECMAScript 4 was mothballed.


Growth and standardization

During the period of
Internet Explorer Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, (from August 16, 1995 to March 30, 2021) commonly abbreviated IE or MSIE) is a discontinued series of s developed by and included in the line of s, starti ...
dominance in the early 2000s, client-side scripting was stagnant. This started to change in 2004, when the successor of Netscape,
Mozilla Mozilla (stylized as moz://a) is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, spreads and supports Mozilla products, thereby promoting exclusively free software and open standards, wit ...

Mozilla
, released the
Firefox Mozilla Firefox or simply Firefox is a free and open-source Free and open-source software (FOSS) is software Software is a collection of Instruction (computer science), instructions and data (computing), data that tell a computer how ...

Firefox
browser. Firefox was well received by many, taking significant market share from Internet Explorer. In 2005, Mozilla joined ECMA International, and work started on the
ECMAScript for XMLECMAScript for XML (E4X) is the standard ISO/IEC 22537:200programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programm ...
(E4X) standard. This led to Mozilla working jointly with
Macromedia Macromedia, Inc., was an American graphics, multimedia, and web development software company (1992–2005) headquartered in San Francisco, California, that made products such as Adobe Flash, Flash and Adobe Dreamweaver, Dreamweaver. It was purcha ...

Macromedia
(later acquired by
Adobe Systems Adobe Inc. ( ) is an American multinational computer software Software is a collection of Instruction (computer science), instructions that tell a computer how to work. This is in contrast to Computer hardware, hardware, from which the sy ...
), who were implementing E4X in their ActionScript 3 language, which was based on an ECMAScript 4 draft. The goal became standardizing ActionScript 3 as the new ECMAScript 4. To this end, Adobe Systems released the
Tamarin The tamarins are squirrel-sized New World monkeys from the family (biology), family Callitrichidae in the genus ''Saguinus''. They are the first offshoot in the Callitrichidae tree, and therefore are sister group of a clade formed by the saddle- ...
implementation as an
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized model ...
project. However, Tamarin and ActionScript 3 were too different from established client-side scripting, and without cooperation from
Microsoft Microsoft Corporation is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multination ...

Microsoft
, ECMAScript 4 never reached fruition. Meanwhile, very important developments were occurring in open-source communities not affiliated with ECMA work. In 2005,
Jesse James Garrett Jesse James Garrett is a User Experience Designer based in San Francisco, California and co-founder of Adaptive Path strategy and design consulting firm. His diagram titled The Elements of User Experience launched his popularity in the web design c ...

Jesse James Garrett
released a white paper in which he coined the term
Ajax Ajax (also AJAX ; short for "Asynchronous and ") is a set of techniques using many web technologies on the to create s. With Ajax, web applications can send and retrieve data from a asynchronously (in the background) without interfering wi ...
and described a set of technologies, of which JavaScript was the backbone, to create
web application A web application (or web app) is application software that runs on a web server, unlike computer-based software programs that are run locally on the operating system (OS) of the device. Web applications are accessed by the user through a web brow ...
s where data can be loaded in the background, avoiding the need for full page reloads. This sparked a renaissance period of JavaScript, spearheaded by open-source libraries and the communities that formed around them. Many new libraries were created, including
jQuery jQuery is a JavaScript library A JavaScript library is a library A library is a curated collection of sources of information and similar resources, made accessible to a defined community for reference or borrowing. It provides physical or ...

jQuery
,
Prototype A prototype is an early sample, model, or release of a product built to test a concept or process. It is a term used in a variety of contexts, including semantics Semantics (from grc, σημαντικός ''sēmantikós'', "significant") ...
,
Dojo Toolkit Dojo Toolkit (stylized as dōjō toolkit) is an open-source modular JavaScript library A JavaScript library is a library A library is a curated collection of sources of information and similar resources, made accessible to a defined communit ...
, and MooTools.
Google Google LLC is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multinational stat ...

Google
debuted its browser in 2008, with the V8 JavaScript engine that was faster than its competition. The key innovation was
just-in-time compilation In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwar ...
(JIT), so other browser vendors needed to overhaul their engines for JIT. In July 2008, these disparate parties came together for a conference in
Oslo Oslo ( , , or ) is the capital Capital most commonly refers to: * Capital letter Letter case (or just case) is the distinction between the letters that are in larger uppercase or capitals (or more formally ''majuscule'') and small ...

Oslo
. This led to the eventual agreement in early 2009 to combine all relevant work and drive the language forward. The result was the ECMAScript 5 standard, released in December 2009.


Reaching maturity

Ambitious work on the language continued for several years, culminating in an extensive collection of additions and refinements being formalized with the publication of
ECMAScript ECMAScript () (or ES) is a JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds o ...
6 in 2015. The creation of
Node.js Node.js is an open-source, cross-platform In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of ...
in 2009 by
Ryan Dahl Ryan Dahl (born 1981) is an American software engineer and the original developer of the Node.js JavaScript JavaScript (), often abbreviated as JS, is a programming language A programming language is a formal language comprising a Instr ...

Ryan Dahl
sparked a significant increase in the usage of JavaScript outside of web browsers. Node combines the V8 engine, an
event loop Event may refer to: Gatherings of people * Ceremony A ceremony (, ) is a unified ritual A ritual is a sequence of activities involving gestures, words, actions, or objects, performed in a sequestered place and according to a set sequence. Rit ...
, and
I/O In computing, input/output (I/O, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system. Information, Inputs are t ...
APIs Apis or APIS may refer to: *Apis (deity) In ancient Egyptian religion Ancient Egyptian religion was a complex system of polytheistic beliefs and rituals that formed an integral part of ancient Egypt Ancient Egypt was a civilization ...
, thereby providing a stand-alone JavaScript runtime system.Sams Teach Yourself Node.js in 24 Hours
, Sams Publishing, 05-Sep-2012
As of 2018, Node had been used by millions of developers, and npm had the most modules of any
package manager A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner. A package manager deals with ...
in the world. The ECMAScript draft specification is currently maintained openly on
GitHub __FORCETOC__ GitHub, Inc. is a provider of Internet hosting service, Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus ...

GitHub
, and editions are produced via regular annual snapshots. Potential revisions to the language are vetted through a comprehensive proposal process. Now, instead of edition numbers, developers check the status of upcoming features individually. The current JavaScript ecosystem has many
libraries A library is a collection of materials, books or media that are easily accessible for use and not just for display purposes. It is responsible for housing updated information in order to meet the user's needs on a daily basis. A library provi ...
and frameworks, established programming practices, and substantial usage of JavaScript outside of web browsers. Plus, with the rise of
single-page application A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current Web design, web page with new data from the web server, instead of the default method of a web browser loading entire n ...
s and other JavaScript-heavy websites, a number of transpilers have been created to aid the development process.


Trademark

"JavaScript" is a
trademark A trademark (also written trade mark or trade-mark) is a type of intellectual property Intellectual property (IP) is a category of property that includes intangible creations of the human intellect. There are many types of intellectual pr ...

trademark
of
Oracle Corporation Oracle Corporation is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multinational ...
in the United States.


Website client-side usage

JavaScript is the dominant
client-side Client-side refers to operations that are performed by the client in a client–server relationship in a computer network A computer network is a group of computers that use a set of common communication protocols over digital signal, digit ...
scripting language of the Web, with 97% of
website A website (also written as web site) is a collection of web page A web page (or webpage) is a hypertext File:Douglas Engelbart in 2008.jpg, Douglas Engelbart in 2009, at the 40th anniversary celebrations of "The Mother of All Demos" i ...

website
s using it for this purpose. Scripts are embedded in or included from
HTML The HyperText Markup Language, or HTML is the standard markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntacticall ...

HTML
documents and interact with the DOM. All major
web browser A web browser (commonly referred to as a browser) is application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typical ...

web browser
s have a built-in
JavaScript engine A JavaScript engine is a computer program A computer program is a collection of instructions that can be executed by a computer to perform a specific task. A computer program is usually written by a computer programmer in a programming lang ...
that executes the code on the user's device.


Examples of scripted behavior

* Loading new
web page A web page (or webpage) is a hypertext Hypertext is text displayed on a or other with references () to other text that the reader can immediately access. Hypertext documents are interconnected by hyperlinks, which are typically acti ...

web page
content without reloading the page, via
Ajax Ajax (also AJAX ; short for "Asynchronous and ") is a set of techniques using many web technologies on the to create s. With Ajax, web applications can send and retrieve data from a asynchronously (in the background) without interfering wi ...
or a
WebSocket WebSocket is a computer communications protocol A communication protocol is a system of rules that allows two or more entities of a communications system 400px, Communication system A communications system or communication system is a ...
. For example, users of
social media Social media are interactive technologies that facilitate the creation Creation may refer to: Religion * Creation ''ex nihilo'', the concept that matter was created by God out of nothing * Creation myth A creation myth (or cosmogonic myth) ...

social media
can send and receive messages without leaving the current page. * Web page animations, such as fading objects in and out, resizing, and moving them. * Playing
browser game A browser game is a video game A video game is an electronic game that involves interaction with a user interface or input device such as a joystick, game controller, controller, computer keyboard, keyboard, or motion sensing device to gene ...
s. * Controlling the playback of
streaming media Streaming media is multimedia that is delivered and consumed in a continuous manner from a source, with little or no intermediate storage in network elements. ''Streaming'' refers to the delivery method of content, rather than the content its ...
. * Generating
pop-up ad Pop-up ads or pop-ups are forms of online advertising Online advertising, also known as online marketing, Internet advertising, digital advertising or web advertising, is a form of marketing and advertising which uses the Internet to deliver ...
s. * Validating input values of a
web form A webform, web form or HTML form on a web page allows a user to enter data that is sent to a server for processing. Forms can resemble paper Paper is a thin sheet material produced by mechanically and/or chemically processing cellulose fibres ...
before the data is sent to a
web server A web server is computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer program, pr ...
. * Logging data about the user's behavior then sending it to a server. The website owner can use this data for
analytics Analytics is the systematic computational analysis of data or statistics. It is used for the discovery, interpretation, and communication of meaningful patterns in data Data are units of information Information can be thought of as the ...
, ad tracking, and
personalization Personalization (broadly known as customization) consists of tailoring a service or a product to accommodate specific individuals, sometimes tied to groups or segments of individuals. A wide variety of organizations use personalization to improve ...
. *Redirecting a user to another page.


Libraries and frameworks

Over 80% of websites use a third-party JavaScript
library A library is a collection of materials, books or media that are easily accessible for use and not just for display purposes. It is responsible for housing updated information in order to meet the user's needs on a daily basis. A library provid ...
or
web framework A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build an ...
for their client-side scripting.
jQuery jQuery is a JavaScript library A JavaScript library is a library A library is a curated collection of sources of information and similar resources, made accessible to a defined community for reference or borrowing. It provides physical or ...

jQuery
is by far the most popular library, used by over 75% of websites.
Facebook Facebook is an American online social media and social networking service owned by Meta Platforms. Founded in 2004 by Mark Zuckerberg with fellow Harvard College students and roommates Eduardo Saverin, Andrew McCollum, Dustin Moskovitz, an ...

Facebook
created the
ReactREACT or React may refer to: Science and technology *REACT (telescope), a telescope at Fenton Hill Observatory, New Mexico, US Computing * React (JavaScript library) , a JavaScript library for building user interfaces, from Facebook ** React Nativ ...
library for its website and later released it as
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized model ...
; other sites, including
Twitter Twitter is an American microblogging Microblogging is an online broadcast medium that exists as a specific form of blogging A blog (a truncation In mathematics and computer science, truncation is limiting the number of numerical di ...

Twitter
, now use it. Likewise, the Angular framework created by
Google Google LLC is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multinational stat ...

Google
for its websites, including
YouTube YouTube is an American online video sharing and social media platform Social media are interactive technologies that allow the Content creation, creation or information sharing, sharing/exchange of information, ideas, career interests, an ...

YouTube
and
Gmail Gmail is a free service provided by . As of 2019, it had 1.5 billion active worldwide. A user typically accesses Gmail in a or the official . Google also supports the use of s via the and protocols. At its launch in 2004, Gmail provided ...
, is now an open source project used by others. In contrast, the term "Vanilla JS" has been coined for websites not using any libraries or frameworks, instead relying entirely on standard JavaScript functionality.


Other usage

The use of JavaScript has expanded beyond its
web browser A web browser (commonly referred to as a browser) is application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typical ...

web browser
roots.
JavaScript engine A JavaScript engine is a computer program A computer program is a collection of instructions that can be executed by a computer to perform a specific task. A computer program is usually written by a computer programmer in a programming lang ...
s are now embedded in a variety of other software systems, both for
server-side In the client–server model Client-server model is a distributed application Distributed computing is a field of computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures ...
website deployments and non-browser
applications Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a co ...
. Initial attempts at promoting server-side JavaScript usage were
Netscape Enterprise Server Oracle iPlanet Web Server (OiWS) is a web server designed for medium and large business applications. Oracle iPlanet Web Server builds on the earlier Sun Java System Web Server, Sun ONE Web Server, iPlanet Web Server, and Netscape Enterprise Serve ...
and
Microsoft Microsoft Corporation is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multination ...

Microsoft
's
Internet Information Services Internet Information Services (IIS, formerly Internet Information Server) is an extensible web server software created by Microsoft for use with the Windows NT family. IIS supports HTTP, HTTP/2, HTTPS, File Transfer Protocol, FTP, FTPS, Simple M ...
, but they were small niches. Server-side usage eventually started to grow in the late 2000s, with the creation of
Node.js Node.js is an open-source, cross-platform In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of ...
and other approaches.
Electron The electron is a subatomic particle (denoted by the symbol or ) whose electric charge is negative one elementary charge. Electrons belong to the first generation (particle physics), generation of the lepton particle family, and are general ...
, Cordova,
React Native React Native is an open-source mobile application framework created by Facebook, Inc. It is used to develop applications for Android, Android TV Android TV is a smart TV operating system based on Android (operating system), Android and deve ...

React Native
, and other
application framework In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, generati ...
s have been used to create many applications with behavior implemented in JavaScript. Other non-browser applications include
Adobe Acrobat Adobe Acrobat is a family of application software and Web services developed by Adobe Inc. to view, create, manipulate, print and manage files in PDF, Portable Document Format (PDF). The family comprises Acrobat Reader (formerly Reader), Acrobat ...
support for scripting
PDF Portable Document Format (PDF), standardized as ISO 32000, is a file format ogg-file: 154 kilobytes. A file format is a standard Standard may refer to: Flags * Colours, standards and guidons * Standard (flag), a type of flag used for pe ...
documents and
GNOME Shell GNOME Shell is the graphical shell of the GNOME desktop environment starting with version 3, which was released on April 6, 2011. It provides basic functions like launching applications, switching between Window (computing), windows and is also a ...

GNOME Shell
extensions written in JavaScript. JavaScript has recently begun to appear in some
embedded system An embedded system is a computer system A computer is a machine that can be programmed to carry out Sequence, sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Com ...
s, usually by leveraging Node.js.


Features

The following features are common to all conforming ECMAScript implementations unless explicitly specified otherwise.


Imperative and structured

JavaScript supports much of the
structured programming Structured programming is a programming paradigm Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms. Some paradigms are concerned mainly with impli ...
syntax from C (e.g., if statements, while loops, switch statements, do while loops, etc.). One partial exception is scoping: originally JavaScript only had function scoping with var; then block scoping was added in ECMAScript 2015 with the keywords let and
const In the C, C++, D, JavaScript JavaScript (), often abbreviated as JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Inpu ...
. Like C, JavaScript makes a distinction between
expressions Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphor#Common types, Metaphorical expression, a parti ...
and
statements Statement or statements may refer to: Common uses *Statement (computer science)In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to ...
. One syntactic difference from C is
automatic semicolon insertion In computer science, lexical analysis, lexing or tokenization is the process of converting a sequence of Character (computing), characters (such as in a computer program or web page) into a sequence of tokens (String (computer science), strings wi ...
, which allow semicolons (which terminate statements) to be omitted.


Weakly typed

JavaScript is weakly typed, which means certain types are implicitly cast depending on the operation used. * The binary + operator casts both operands to a string unless both operands are numbers. This is because the addition operator doubles as a concatenation operator * The binary - operator always casts both operands to a number * Both unary operators (+, -) always cast the operand to a number Values are cast to strings like the following: * Strings are left as-is * Numbers are converted to their string representation * Arrays have their elements cast to strings after which they are joined by commas (,) * Other objects are converted to the string bject Object/code> where Object is the name of the constructor of the object Values are cast to numbers by casting to strings and then casting the strings to numbers. These processes can be modified by defining toString and valueOf functions on the
prototype A prototype is an early sample, model, or release of a product built to test a concept or process. It is a term used in a variety of contexts, including semantics Semantics (from grc, σημαντικός ''sēmantikós'', "significant") ...
for string and number casting respectively. JavaScript has received criticism for the way it implements these conversions as the complexity of the rules can be mistaken for inconsistency. For example, when adding a number to a string, the number will be cast to a string before performing concatenation, but when subtracting a number from a string, the string is cast to a number before performing subtraction. Often also mentioned is + [] resulting in 0 (number). This is misleading: the is interpreted as an empty code block instead of an empty object, and the empty array is cast to a number by the remaining unary + operator. If you wrap the expression in parentheses ( + []) the curly brackets are interpreted as an empty object and the result of the expression is "[object Object]" as expected.


Dynamic

; Typing:JavaScript is
dynamically typed In programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming languages are used in computer programming to i ...
like most other
scripting language A scripting language or script language is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming language ...
s. A
type Type may refer to: Science and technology Computing * Typing, producing text via a keyboard, typewriter, etc. * Data type, collection of values used for computations. * File type * TYPE (DOS command), a command to display contents of a file. * Type ...
is associated with a
value Value or values may refer to: * Value (ethics) it may be described as treating actions themselves as abstract objects, putting value to them ** Values (Western philosophy) expands the notion of value beyond that of ethics, but limited to Western s ...
rather than an expression. For example, a variable initially bound to a number may be reassigned to a
string String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * Strings (1991 film), ''Strings'' (1991 fil ...
. JavaScript supports various ways to test the type of objects, including
duck typing Duck typing in computer programming is an application of the duck test—"If it walks like a duck and it quacks like a duck, then it must be a duck"—to determine whether an object (computer science), object can be used for a particular pu ...
. ; Run-time evaluation: JavaScript includes an
eval In some programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming languages are used in computer programming ...

eval
function that can execute statements provided as strings at run-time.


Object-orientation (prototype-based)

Prototypal inheritance in JavaScript is described by
Douglas Crockford Douglas Crockford is an United States, American computer programmer and entrepreneur who is involved in the development of the JavaScript language. He popularized the data format JSON (JavaScript Object Notation), and has developed various JavaScr ...

Douglas Crockford
as: In JavaScript, an
object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Entity, something that is tangible and within the grasp of the senses ** Object (abstract), an object which does not exist at any particular time or pl ...
is an
associative array In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algo ...
, augmented with a prototype (see below); each key provides the name for an object
property Property is a system of rights that gives people legal control of valuable things, and also refers to the valuable things themselves. Depending on the nature of the property, an owner of property may have the right to , alter, , , , , , , , or ...
, and there are two syntactical ways to specify such a name: dot notation (obj.x = 10) and bracket notation (obj x'nbsp;= 10). A property may be added, rebound, or deleted at run-time. Most
properties Property (''latin: Res Privata'') in the abstract is what belongs to or with something, whether as an attribute or as a component of said thing. In the context of this article, it is one or more components (rather than attributes), whether phys ...
of an object (and any property that belongs to an object's prototype inheritance chain) can be enumerated using a for...in loop. ; Prototypes: JavaScript uses
prototypes A prototype is an early sample, model, or release of a product built to test a concept or process. It is a term used in a variety of contexts, including semantics, design, electronics, and Software prototyping, software programming. A prototype ...
where many other object-oriented languages use
classes Class or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used differently f ...
for
inheritance Inheritance is the practice of passing on private property Private property is a legal designation for the ownership of property by non-governmental legal entities. Private property is distinguishable from public property Public property i ...
. It is possible to simulate many class-based features with prototypes in JavaScript. ; Functions as object constructors: Functions double as object constructors, along with their typical role. Prefixing a function call with ''new'' will create an instance of a prototype, inheriting properties and methods from the constructor (including properties from the Object prototype). ECMAScript 5 offers the Object.create method, allowing explicit creation of an instance without automatically inheriting from the Object prototype (older environments can assign the prototype to null). The constructor's prototype property determines the object used for the new object's internal prototype. New methods can be added by modifying the prototype of the function used as a constructor. JavaScript's built-in constructors, such as Array or Object, also have prototypes that can be modified. While it is possible to modify the Object prototype, it is generally considered bad practice because most objects in JavaScript will inherit methods and properties from the Object prototype, and they may not expect the prototype to be modified. ; Functions as methods: Unlike many object-oriented languages, there is no distinction between a function definition and a
method Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to: *Scient ...
definition. Rather, the distinction occurs during function calling; when a function is called as a method of an object, the function's local ''this'' keyword is bound to that object for that invocation.


Functional

A
function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
is
first-class First class (or 1st class, Firstclass) generally implies a high level of service, importance or quality. Specific uses of the term include: Books and Comics * ''First Class'', List of Dandy comic strips, a comic strip in ''The Dandy'' (1983-1998 ...
; a function is considered to be an object. As such, a function may have properties and methods, such as .call() and .bind(). A ''nested'' function is a function defined within another function. It is created each time the outer function is invoked. In addition, each nested function forms a lexical closure: the
lexical scopeIn computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, generatin ...
of the outer function (including any constant, local variable, or argument value) becomes part of the internal state of each inner function object, even after execution of the outer function concludes. JavaScript also supports
anonymous function Anonymous may refer to: * Anonymity Anonymity describes situations where the acting person's identity is unknown. Some writers have argued that namelessness, though technically correct, does not capture what is more centrally at stake in context ...
s.


Delegative

JavaScript supports implicit and explicit
delegation Schermerhorn, J., Davidson, P., Poole, D., Woods, P., Simon, A., & McBarron, E. (2017). ''Management'' (6th ed., pp. 282–286). Brisbane: John Wiley & Sons Australia. Delegation is one of the core concepts of management Management (or managing ...
. ; Functions as roles (Traits and Mixins): JavaScript natively supports various function-based implementations of
Role A role (also rôle or social role) is a set of connected behaviors, rights, moral obligation, obligations, beliefs, and social norm, norms as conceptualized by people in a social situation. It is an expected or free or continuously changing behav ...
patterns like
Traits Trait may refer to: * Phenotypic trait in biology, which involve genes and characteristics of organisms * Trait (computer programming), a model for structuring object-oriented programs (a template class in the C++ programming language) * Trait the ...
and
Mixin In object-oriented programming languages, a mixin (or mix-in) is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depen ...
s. Such a function defines additional behavior by at least one method bound to the this keyword within its function body. A Role then has to be delegated explicitly via call or apply to objects that need to feature additional behavior that is not shared via the prototype chain. ; Object composition and inheritance: Whereas explicit function-based delegation does cover
composition Composition or Compositions may refer to: Arts * Composition (dance), practice and teaching of choreography * Composition (music), an original piece of music and its creation *Composition (visual arts) The term composition means "putting togethe ...
in JavaScript, implicit delegation already happens every time the prototype chain is walked in order to, e.g., find a method that might be related to but is not directly owned by an object. Once the method is found it gets called within this object's context. Thus
inheritance Inheritance is the practice of passing on private property Private property is a legal designation for the ownership of property by non-governmental legal entities. Private property is distinguishable from public property Public property i ...
in JavaScript is covered by a delegation automatism that is bound to the prototype property of constructor functions.


Miscellaneous

JS is a zero-index language. ; Run-time environment:JavaScript typically relies on a run-time environment (e.g., a
web browser A web browser (commonly referred to as a browser) is application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typical ...

web browser
) to provide objects and methods by which scripts can interact with the environment (e.g., a web page DOM). These environments are single- threaded. JavaScript also relies on the run-time environment to provide the ability to include/import scripts (e.g.,
HTML The HyperText Markup Language, or HTML is the standard markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntacticall ...

HTML