[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Operators/void [Back]  [Original]

void operator - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

void operator

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

void undefined.

In this article

void expression

, , , undefined.

void undefined, "void(0)" ( "void 0"). undefined (, ).

(IIFE)

void .

js
void (function iife() {
  var bar = function () {};
  var baz = function () {};
  var foo = function () {
    bar();
    baz();
  };
  var biz = function () {};

  foo();
  biz();
})();

JavaScript URIs

javascript: URI, URI , undefined. void undefined. :

html
<a href="javascript:void(0);">Click here to do nothing</a>

<a href="javascript:void(document.body.style.backgroundColor='green');">
  Click here for green background
</a>

, - javascript:. , , .

Specification
ECMAScript 2027 LanguageSpecification
# sec-void-operator


Web Proxy Viewer  |  New URL  |  Original Page