From 980fe00a74a9ad013b945755415ace2e5429c3c2 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Wed, 27 Oct 2021 02:31:24 +0300 Subject: [RU] Remove notranslate (#2874) --- .../reference/global_objects/object/create/index.html | 10 +++++----- .../reference/global_objects/object/entries/index.html | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'files/ru/web/javascript/reference/global_objects/object') diff --git a/files/ru/web/javascript/reference/global_objects/object/create/index.html b/files/ru/web/javascript/reference/global_objects/object/create/index.html index f7b4d2c69b..09ac00405a 100644 --- a/files/ru/web/javascript/reference/global_objects/object/create/index.html +++ b/files/ru/web/javascript/reference/global_objects/object/create/index.html @@ -17,7 +17,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/create

Синтаксис

-
Object.create(proto[, propertiesObject])
+
Object.create(proto[, propertiesObject])

Параметры

@@ -42,7 +42,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/create

Ниже показан пример использования Object.create() для имитации классического наследования. Это пример одиночного наследования, поскольку только его поддерживает JavaScript.

-
// Shape — суперкласс
+
// Shape — суперкласс
 function Shape() {
   this.x = 0;
   this.y = 0;
@@ -73,7 +73,7 @@ rect.move(1, 1); // выведет 'Фигура переместилась.'
 
 

Если вы хотите наследоваться от нескольких объектов, то это возможно сделать при помощи примесей.

-
function MyClass() {
+
function MyClass() {
   SuperClass.call(this);
   OtherSuperClass.call(this);
 }
@@ -90,7 +90,7 @@ MyClass.prototype.myMethod = function() {
 
 

Пример: использование аргумента propertiesObject с Object.create()

-
var o;
+
var o;
 
 // создаём объект с нулевым прототипом
 o = Object.create(null);
@@ -159,7 +159,7 @@ o2 = Object.create({}, {
 
 

Для этого полифила необходима правильно работающая Object.prototype.hasOwnProperty.

-
if (typeof Object.create != 'function') {
+
if (typeof Object.create != 'function') {
   // Этапы производства ECMA-262, издание 5, 15.2.3.5
   // Ссылка: http://es5.github.io/#x15.2.3.5
   Object.create = (function() {
diff --git a/files/ru/web/javascript/reference/global_objects/object/entries/index.html b/files/ru/web/javascript/reference/global_objects/object/entries/index.html
index fd74a6a286..5cba32dbc5 100644
--- a/files/ru/web/javascript/reference/global_objects/object/entries/index.html
+++ b/files/ru/web/javascript/reference/global_objects/object/entries/index.html
@@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/entries
 
 

Синтаксис

-
Object.entries(obj)
+
Object.entries(obj)

Параметры

@@ -30,7 +30,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/entries

Примеры

-
var obj = { foo: "bar", baz: 42 };
+
var obj = { foo: "bar", baz: 42 };
 console.log(Object.entries(obj)); // [ ['foo', 'bar'], ['baz', 42] ]
 
 // массив как объект
@@ -49,7 +49,7 @@ console.log(Object.entries(my_obj)); // [ ['foo', 'bar'] ]
 // non-object argument will be coerced to an object
 console.log(Object.entries("foo")); // [ ['0', 'f'], ['1', 'o'], ['2', 'o'] ]
-
// returns an empty array for any primitive type, since primitives have no own properties
+
// returns an empty array for any primitive type, since primitives have no own properties
 console.log(Object.entries(100)); // [ ]
 
 // iterate through key-value gracefully
@@ -67,7 +67,7 @@ Object.entries(obj).forEach(([key, value]) => {
 
 

Конструктор {{jsxref("Map", "new Map()")}} принимает повторение значений. С Object.entries вы легко можете преобразовать {{jsxref("Object")}} в {{jsxref("Map")}}:

-
var obj = { foo: "bar", baz: 42 };
+
var obj = { foo: "bar", baz: 42 };
 var map = new Map(Object.entries(obj));
 console.log(map); // Map { foo: "bar", baz: 42 }
@@ -75,7 +75,7 @@ console.log(map); // Map { foo: "bar", baz: 42 }

Используя метод Разбора Массивов Вы можете легко итерировать объекты.

-
const obj = { foo: 'bar', baz: 42 };
+
const obj = { foo: 'bar', baz: 42 };
 Object.entries(obj).forEach(([key, value]) => console.log(`${key}: ${value}`)); // "foo: bar", "baz: 42"

Полифил

-- cgit v1.2.3-54-g00ecf