Home › Categories › Programming & Languages › JavaScript

JavaScript

From WikiTech, the encyclopedia of technology

Technology · Programming & Languages · 4 min read · 799 words · Updated

JavaScript
Technology
JavaScript — article photograph or illustration
Image placeholderPlace the file shown below in the assets/articles folder
File: javascript.webp
Designed byBrendan Eich
First released1995
StandardECMAScript (ECMA-262)
Main environmentsWeb browsers, Node.js, embedded runtimes
Programming styleMulti-paradigm, dynamic, prototype-based

JavaScript is a high-level programming language widely used to make web pages interactive. Browsers include JavaScript engines that execute scripts, allowing a page to respond to user input, update content, communicate with servers and manage application state. JavaScript is also used outside browsers through runtimes such as Node.js and in desktop applications built with web technologies.[1]

Origins and standardisation

Brendan Eich created JavaScript at Netscape in 1995. The language was initially designed for browser scripting, where it needed to be approachable and integrate with HTML documents. It later became a foundation of the web platform. Its standardised form is called ECMAScript; JavaScript is the common name used for the language and its ecosystem. TC39, a committee within Ecma International, maintains the ECMAScript specification and develops additions through a public proposal process.[2]

Standardisation matters because web applications run on many independent browser engines. New features need agreed semantics and careful implementation so that the same program behaves consistently across platforms. Browser APIs such as the DOM and Fetch API are related to JavaScript but are specified by web platform standards rather than by the language specification alone.

Language model

JavaScript is dynamically typed: values have types, while variables can refer to values of different types during execution. It supports objects, functions, closures, classes, modules and prototype-based inheritance. Functions are first-class values, so they can be stored, passed to other functions and returned as results. The language supports imperative, functional and object-oriented styles.

The language's coercion rules can be surprising, so explicit comparisons and clear data boundaries are important. === performs strict equality without the implicit conversions used by ==. Modern code commonly uses const and let for block-scoped bindings, while var remains in older code. Modules provide a standard way to split applications into files and control dependencies.

The browser runtime and event loop

JavaScript execution in a browser is coordinated with browser tasks, rendering and other platform work. The event loop schedules callbacks and microtasks, while asynchronous APIs allow code to wait for network or timer events without blocking the main thread. Promises represent eventual results, and async/await provides syntax for working with promise-based operations. These features do not make CPU-heavy JavaScript parallel: long computations can still block rendering and input handling.

The event loop explains why asynchronous code can remain responsive while waiting for I/O. Web Workers provide a separate execution context for work that should not run on the main thread. Communication between workers uses message passing, which helps avoid some shared-memory problems but requires developers to design data transfer and task boundaries carefully.

JavaScript beyond the browser

Node.js uses a JavaScript engine together with APIs for files, networking and process management. It is commonly used for web servers, command-line tools and build systems. Runtime environments differ in their APIs even when they execute the same language, so browser code cannot automatically use server-side modules such as filesystem access. Frameworks and packages add functionality, but projects should review dependencies and keep their build process reproducible.

Strengths, limitations and security

JavaScript's main strength is its direct integration with the web platform and broad availability. Its dynamic nature enables rapid development, while the large ecosystem offers libraries for many common tasks. The trade-offs include runtime type errors, package-management complexity and the need to manage asynchronous control flow. Static analysis and TypeScript can help larger teams detect mistakes before code runs.

Security depends on how applications handle untrusted input, origins, cookies and browser permissions. Inserting untrusted strings as HTML can create cross-site scripting vulnerabilities. Developers should use safe DOM APIs, apply context-appropriate output encoding and understand Content Security Policy. The browser sandbox is an important layer, but it does not make unsafe application code harmless.

Relationship to the wider web

JavaScript works with HTML for document structure and CSS for presentation. It commonly exchanges JSON data with servers over HTTP. These technologies have separate responsibilities, and keeping those boundaries clear makes web applications easier to test, maintain and secure.

Further engineering considerations

Compatibility, maintenance and long-lived applications

JavaScript applications often remain in use for years, so compatibility is a practical engineering concern. A browser may support a new language feature before every device used by an audience does. Teams therefore define a browser support policy and, where necessary, use a build tool to transform newer syntax into forms supported by older environments. Polyfills can supply selected missing APIs, although they should be added carefully because they increase download size and may not reproduce every platform behaviour.

Maintenance also depends on controlling asynchronous work and shared state. Promises and async functions make asynchronous control flow easier to follow, but they do not remove the need to handle rejected operations, cancellation, timeouts or stale results. A robust interface should communicate loading and error states rather than assuming every network request succeeds. Module boundaries, tests and clear data contracts make a JavaScript codebase easier to change as it grows. These practices connect language-level knowledge with broader topics such as the event loop, HTTP and React.

See also

  • CSS – The style sheet language that controls the presentation, layout and responsive behaviour of HTML documents.
  • HTML – The standard markup language used to structure documents and applications on the World Wide Web.
  • TypeScript – A language that extends JavaScript with a static type system and compiles to ordinary JavaScript.
  • React – A JavaScript library for building user interfaces from composable components.
  • JSON – A lightweight text format for structured data based on JavaScript object syntax.
  • WebAssembly – A portable binary instruction format that runs at near-native speed in browsers and other runtimes.
  • C (programming language) – A general-purpose, statically typed systems programming language created at Bell Labs in the early 1970s.
  • Garbage Collection – Automatic memory management in which a runtime reclaims memory that a program can no longer reach.

References

  1. ↑ MDN Web Docs: JavaScript (developer.mozilla.org)
  2. ↑ ECMA-262: ECMAScript Language Specification (tc39.es)
  3. ↑ WHATWG HTML Standard (html.spec.whatwg.org)