You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works, because the internal algorithm of the built-in`join`method only cares about the correct indexes and the `length` property, it doesn't check that the object is indeed the array. And many built-in methods are like that.
182
+
Это работает, потому что для внутреннего алгоритма встроенного метода`join`важна только корректность индексов и свойства `length`, он не проверяет является ли объект на самом деле массивом. И многие встроенные методы работают так же.
183
183
184
-
Another possibility is to inherit by setting `obj.__proto__`to`Array.prototype`, so all `Array`methods are automatically available in`obj`.
184
+
!! Другая возможность -- наследование, установив `obj.__proto__`как`Array.prototype`, таким образом все методы `Array`станут автоматически доступны в`obj`.
185
185
186
-
But that's impossible if `obj`already inherits from another object. Remember, we only can inherit from one object at a time.
186
+
Но это будет невозможно, если `obj`уже наследуется от другого объекта. Помните, мы можем наследоваться только от одного объекта одновременно.
187
187
188
-
Borrowing methods is flexible, it allows to mix functionality from different objects if needed.
188
+
Одалживание методов гибкий способ, он позволяет смешивать функциональность разных объектов по необходимости.
0 commit comments