From a065e04d529da1d847b5062a12c46d916408bf32 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 21:46:22 -0500 Subject: update based on https://github.com/mdn/yari/issues/2028 --- .../reference/statements/for_each...in/index.html | 126 --------------------- 1 file changed, 126 deletions(-) delete mode 100644 files/ru/web/javascript/reference/statements/for_each...in/index.html (limited to 'files/ru/web/javascript/reference/statements/for_each...in/index.html') diff --git a/files/ru/web/javascript/reference/statements/for_each...in/index.html b/files/ru/web/javascript/reference/statements/for_each...in/index.html deleted file mode 100644 index c609f436c0..0000000000 --- a/files/ru/web/javascript/reference/statements/for_each...in/index.html +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: for each...in -slug: Web/JavaScript/Reference/Statements/for_each...in -translation_of: Archive/Web/JavaScript/for_each...in ---- -
{{jsSidebar("Statements")}}
- -
-

Конструкция for each...in заявлена как "deprecated", как часть стандарта ECMA-357 (E4X). Поддержка E4X была удалена. Вместо for each...in рассмотрите использование for...of. (Пожалуйста обратите внимание: {{ bug("791343")}}.)
-
- Firefox теперь предупреждает об использовании for each...in и for each...in удаляется из ночных сборок. Пожалуйста, посмотрите Warning: JavaScript 1.6's for-each-in loops are deprecated для помощи в миграции.

-
- -

Выражение for each...in выполняет перебор свойств указанного объекта. Для каждого свойства выполняется указанный оператор.

- -

Синтаксис

- -
for each (variable in object) {
-  statement
-}
- -
-
variable
-
Variable to iterate over property values, optionally declared with the var keyword. This variable is local to the function, not to the loop.
-
- -
-
object
-
Object for which the properties are iterated.
-
- -
-
statement
-
A statement to execute for each property. To execute multiple statements within the loop, use a block statement ({ ... }) to group those statements.
-
- -

Description

- -

Some built-in properties are not iterated over. These include all built-in methods of objects, e.g. String's indexOf method. However, all user-defined properties are iterated over.

- -

Examples

- -

Using for each...in

- -

Warning: Never use a loop like this on arrays. Only use it on objects. See for...in for more details.

- -

The following snippet iterates over an object's properties, calculating their sum:

- -
var sum = 0;
-var obj = {prop1: 5, prop2: 13, prop3: 8};
-
-for each (var item in obj) {
-  sum += item;
-}
-
-console.log(sum); // logs "26", which is 5+13+8
- -

Specifications

- -

Not part of a current ECMA-262 specification. Implemented in JavaScript 1.6 and deprecated.

- -

Браузерная совместимость

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatNo}}{{CompatGeckoDesktop("1.8")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("1.0")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

Firefox specific note

- - - -

Смотрите также

- - -- cgit v1.2.3-54-g00ecf