[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/Empty [Back]  [Original]

empty - 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

empty

Baseline Widely available

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

empty JavaScript .

In this article

const array1 = [1, 2, 3];

// Assign all array values to 0
for (let i = 0; i < array1.length; array1[i++] = 0 /* empty statement */);

console.log(array1);
// Expected output: Array [0, 0, 0]

js
;

empty statement JavaScript (;). JavaScript block statement .

. .

js
var arr = [1, 2, 3];

// Assign all array values to 0
for (i = 0; i < arr.length; arr[i++] = 0 /* empty statement */);

console.log(arr);
// [0, 0, 0]

: , empty statement . . killTheUniverse() if .

js
if (condition);       // Caution, this "if" does nothing!
   killTheUniverse()  // So this always gets executed!!!

: ({}) if...else three true four else case launchRocket() .

js
if (one) doOne();
else if (two) doTwo();
else if (three); // nothing here
else if (four)
  doFour();
else launchRocket();

Specification
ECMAScript 2027 LanguageSpecification
# sec-empty-statement

See also


Web Proxy Viewer  |  New URL  |  Original Page