{"id":293162,"date":"2019-08-09T03:00:13","date_gmt":"2019-08-09T03:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=293162"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=293162","title":{"rendered":"Defined or Undefined? \u041d\u044e\u0430\u043d\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432 JavaScript"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cf\/uz\/xt\/cfuzxt6gszx356ckhbffnh21g9g.jpeg\" alt=\"image\"><\/div>\n<p>  \u041f\u0430\u0440\u0443 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 <i>stackoverflow<\/i>, \u0442\u0430\u043c, \u0435\u0441\u043b\u0438 \u0432\u043a\u0440\u0430\u0442\u0446\u0435, \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0445\u043e\u0442\u0435\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <i>5\u04455<\/i>, \u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0443 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u043d\u0435\u0442. \u0412 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0432\u0448\u0435\u0439\u0441\u044f \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0451\u0442 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u044b\u0441\u043b\u0438. <\/p>\n<p>  \u041f\u0440\u0430\u0432\u0434\u0430, \u0437\u0430\u0434\u0430\u0432\u0448\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0442\u0435 \u043a\u0442\u043e \u0435\u043c\u0443 \u043e\u0442\u0432\u0435\u0447\u0430\u043b, \u043d\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d. \u0412\u0441\u0451 \u044d\u0442\u043e \u043c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u043e, \u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u043a\u043e\u043f\u043d\u0443\u0442\u044c \u0447\u0443\u0442\u044c \u0433\u043b\u0443\u0431\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0439\u0442\u0438 \u043a \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0443\u043c\u043e\u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0441 \u0432\u0430\u043c\u0438 \u0438 \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c. <br \/>  <a name=\"habracut\"><\/a><br \/>  <i>\u041f\u0440\u0438\u043c.: \u044f \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b \u0438 \u043f\u043e\u0434 \u0442\u043e\u0439 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0435\u0439, \u043f\u043e\u0434 \u043d\u0438\u043a\u043e\u043c <i>AndreyGS <\/i>\u2013 \u0442\u0430\u043c \u044f \u043e\u0442\u0432\u0435\u0442\u0438\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0430\u0442\u043a\u043e, \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043e\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/i><\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c \u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432. \u041a\u0430\u043a \u0436\u0435 \u043c\u044b \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u041a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c.<\/p>\n<p>  \u041d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 JavaScript \u0438\u043c\u0435\u044e\u0442 \u0434\u0432\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 <i>Call <\/i>\u0438 <i>Construct<\/i>. \u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <i>new<\/i>, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 Construct, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u043e\u0432\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0435\u043c\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 <i>this <\/i>, \u0438, \u0437\u0430\u0442\u0435\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0435\u043b\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u0435 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043c\u0435\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043d\u043e \u043d\u0430\u043c \u044d\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u0432\u0430\u0436\u043d\u043e.<\/p>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c: \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u044b <i>Array(\u2026)<\/i> \u0438\u043b\u0438 <i>new Array(\u2026)<\/i> \u2014 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f <i>ECMAScript <\/i>\u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0434\u043b\u044f \u043d\u0438\u0445 \u0438, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0445 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u043c\u0438.<\/p>\n<p>  <code>22.1.1 The Array Constructor<br \/>  The Array constructor is the %Array% intrinsic object and the initial value of the Array property of the global object. When called as a constructor it creates and initializes a new exotic Array object. When Array is called as a function rather than as a constructor, it also creates and initializes a new Array object. Thus the function call Array(\u2026) is equivalent to the object creation expression new\u00a0Array(\u2026) with the same arguments.<\/code><\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043c\u0443\u0434\u043e\u0440\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043b\u0443\u043a\u0430\u0432\u043e, \u0438, \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <i>new Array(\u2026)<\/i>, \u0434\u0430\u0431\u044b \u043d\u0435 \u0441\u0431\u0438\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u043e\u0433\u043e \u0441 \u0442\u043e\u043b\u043a\u0443.<br \/>  \u041d\u0430\u0447\u043d\u0451\u043c.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0430\u0441\u0441\u0438\u0432:<\/p>\n<pre><code class=\"javascript\">let arr = new Array(5);<\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0436\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c?<\/p>\n<pre><code class=\"javascript\">console.log(arr); \/\/ Array(5) [ &lt;5 empty slots&gt; ] console.log(arr[0]); \/\/ undefined console.log(Object.getOwnPropertyDescriptor(arr,\"0\")); \/\/ undefined<\/code><\/pre>\n<p>  \u0425\u043c\u2026 \u043d\u0443, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0442\u0430\u043a \u0432\u0435\u0434\u044c \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u2014 \u043c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0434\u043b\u0438\u043d\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u044f\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u0445 \u044f\u0447\u0435\u0435\u043a, \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <i>undefined<\/i>, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u0432\u0435\u0440\u043d\u043e? \u041f\u0440\u0430\u0432\u0434\u0430, \u0435\u0441\u0442\u044c \u0442\u0443\u0442 \u043f\u0430\u0440\u0430 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u043d\u044f \u0441\u043c\u0443\u0449\u0430\u044e\u0442. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c.<\/p>\n<pre><code class=\"javascript\">let arr = new Array(5).map(function() { return new Array(5); });  console.log(arr); \/\/ Array(5) [ &lt;5 empty slots&gt; ] console.log(arr[0]); \/\/ undefined console.log(Object.getOwnPropertyDescriptor(arr,\"0\")); \/\/ undefined console.log(arr[0][0]); \/\/ TypeError: arr[0] is undefined<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0436\u0435 \u0442\u0430\u043a, \u0432\u0435\u0434\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443, \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 5 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432\u2026<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <i>ECMAScript <\/i>\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0441 \u043e\u0434\u043d\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c:<\/p>\n<p>  <code>22.1.1.2 Array (len)<br \/>  This description applies if and only if the Array constructor is called with exactly one argument.<\/p>\n<p>  1. Let numberOfArgs be the number of arguments passed to this function call. <br \/>   2. Assert: numberOfArgs = 1. <br \/>   3. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. <br \/>   4. Let proto be GetPrototypeFromConstructor(newTarget, \"%ArrayPrototype%\"). <br \/>   5. ReturnIfAbrupt(proto). <br \/>   6. Let array be ArrayCreate(0, proto). <br \/>   7. If Type(len) is not Number, then <br \/>   1. Let defineStatus be CreateDataProperty(array, \"0\", len). <br \/>   2. Assert: defineStatus is true. <br \/>   3. Let intLen be 1. <br \/>   8. Else, <br \/>   1. Let intLen be ToUint32(len). <br \/>   2. If intLen \u2260 len, throw a RangeError exception. <br \/>   9. Let setStatus be Set(array, \"length\", intLen, true). <br \/>   10. Assert: setStatus is not an abrupt completion. <br \/>   11. Return array. <\/code><\/p>\n<p>  \u0418, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <i>length <\/i>\u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 ArrayCreate(6 \u043f\u0443\u043d\u043a\u0442), \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 <i>length <\/i>\u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e (\u043f\u0443\u043d\u043a\u0442 9), \u0430 \u0447\u0442\u043e \u0441 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438? \u041f\u0440\u043e \u043d\u0438\u0445 \u043d\u0438 \u0441\u043b\u043e\u0432\u0430\u2026 \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u0430 == 5 \u0435\u0441\u0442\u044c, \u0430 \u043f\u044f\u0442\u0438 \u044f\u0447\u0435\u0435\u043a \u043d\u0435\u0442. \u0414\u0430, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0443\u0442\u0430\u0435\u0442 \u043d\u0430\u0441, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435, \u043e\u043d \u0432\u044b\u0434\u0430\u0451\u0442, \u0447\u0442\u043e \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <i>undefined<\/i>, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0435\u0451 \u0432 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0442.<\/p>\n<p>  \u0412\u043e\u0442, \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440:<\/p>\n<p>  <code>22.1.1.3 Array (...items )<br \/>  This description applies if and only if the Array constructor is called with at least two arguments.<br \/>  When the Array function is called the following steps are taken:<\/p>\n<p>  1. Let numberOfArgs be the number of arguments passed to this function call. <br \/>   2. Assert: numberOfArgs \u2265 2. <br \/>   3. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. <br \/>   4. Let proto be GetPrototypeFromConstructor(newTarget, \"%ArrayPrototype%\"). <br \/>   5. ReturnIfAbrupt(proto). <br \/>   6. Let array be ArrayCreate(numberOfArgs, proto). <br \/>   7. ReturnIfAbrupt(array). <br \/>   8. Let k be 0. <br \/>   9. Let items be a zero-origined List containing the argument items in order. <br \/>   10. Repeat, while k &lt; numberOfArgs <br \/>   1. Let Pk be ToString(k). <br \/>   2. Let itemK be items[k]. <br \/>   3. Let defineStatus be CreateDataProperty(array, Pk, itemK). <br \/>   4. Assert: defineStatus is true. <br \/>   5. Increase k by 1. <br \/>   11. Assert: the value of array\u2019s length property is numberOfArgs. <br \/>   12. Return array. <\/code><\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u2014 10 \u043f\u0443\u043d\u043a\u0442, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0435\u0445 \u0441\u0430\u043c\u044b\u0445 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<p>  \u0418 \u0442\u0430\u043a, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043d\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043f\u043e \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u043d\u043e\u0439, \u0438\u0431\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430. \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442 <i>Function.prototype.apply()<\/i>!<br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0435\u0451 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">let arr = Array.apply(null, new Array(5));  console.log(arr); \/\/ Array(5) [ undefined, undefined, undefined, undefined, undefined ] console.log(arr[0]); \/\/ undefined console.log(Object.getOwnPropertyDescriptor(arr,\"0\")); \/\/ Object { value: undefined, writable: true, enumerable: true, configurable: true }<\/code><\/pre>\n<p>  \u0423\u0440\u0430, \u0437\u0434\u0435\u0441\u044c \u043e\u0442\u0447\u0435\u0442\u043b\u0438\u0432\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u044f\u0442\u044c \u044f\u0447\u0435\u0435\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443 \u043f\u0435\u0440\u0432\u043e\u0439, \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439, \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u043e\u043c <i>\u201c0\u201d<\/i> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ol>\n<li>\u041c\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <i>Function.prototype.apply()<\/i> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0435\u043c\u0443 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 <i>null<\/i>, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <i>new Array(5)<\/i>.<\/li>\n<li><i>new Array(5)<\/i> \u0441\u043e\u0437\u0434\u0430\u043b \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0435\u0437 \u044f\u0447\u0435\u0435\u043a, \u043d\u043e \u0441 \u0434\u043b\u0438\u043d\u043e\u0439 <i>5<\/i>.<\/li>\n<li><i>Function.prototype.apply()<\/i> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0437\u0431\u0438\u0442\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e, \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0443 <i>Array <\/i>\u043f\u044f\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <i>undefined<\/i>.<\/li>\n<li><i>Array <\/i>\u043f\u043e\u043b\u0443\u0447\u0438\u0432 <i>5 <\/i>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <i>undefined<\/i>, \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0438\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438.<\/li>\n<\/ol>\n<p>  \u0412\u0441\u0451 \u0432\u0440\u043e\u0434\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0437\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0443 <i>Function.prototype.apply()<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437 \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u0442 <i>5 <\/i>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u2014 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u043f\u044f\u0442\u044c \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e <i>ECMAScript<\/i>:<\/p>\n<p>  <code>19.2.3.1 Function.prototype.apply<\/p>\n<p>  1. If IsCallable(func) is false, throw a TypeError exception.<br \/>   2. If argArray is null or undefined, then Return Call(func, thisArg).<br \/>   3. Let argList be CreateListFromArrayLike(argArray).<\/p>\n<p>  7.3.17 CreateListFromArrayLike (obj [, elementTypes] ) <\/p>\n<p>  1. ReturnIfAbrupt(obj).<br \/>   2. If elementTypes was not passed, let elementTypes be (Undefined, Null, Boolean, String, Symbol, Number, Object).<br \/>   3. If Type(obj) is not Object, throw a TypeError exception.<br \/>   4. Let len be ToLength(Get(obj, \"length\")).<br \/>   5. ReturnIfAbrupt(len).<br \/>   6. Let list be an empty List.<br \/>   7. Let index be 0.<br \/>   8. Repeat while index &lt; len<br \/>   a. Let indexName be ToString(index).<br \/>   b. Let next be Get(obj, indexName).<br \/>   c. ReturnIfAbrupt(next).<br \/>   d. If Type(next) is not an element of elementTypes, throw a TypeError exception.<br \/>   e. Append next as the last element of list.<br \/>   f. Set index to index + 1.<br \/>   9. Return list.<\/code><\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0430\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b: <\/p>\n<p>  19.2.3.1 \u2014 \u043f\u0443\u043d\u043a\u0442 3: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 (\u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c \u0443 \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u0438\u043d\u044b).<\/p>\n<p>  7.3.17 \u2014 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430. \u0412 \u043d\u0451\u043c \u0438\u0434\u0451\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0442\u043e, \u043e\u0431\u044a\u0435\u043a\u0442 \u044d\u0442\u043e \u0438\u043b\u0438 \u043d\u0435\u0442, \u0438, \u0435\u0441\u043b\u0438 \u0434\u0430, \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f <i>length <\/i>(\u043f\u0443\u043d\u043a\u0442 4). \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441, \u0440\u0430\u0432\u043d\u044b\u0439 <i>\u201c0\u201d<\/i> (\u043f\u0443\u043d\u043a\u0442 7). \u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0446\u0438\u043a\u043b \u0441 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0434\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0437\u044f\u0442\u043e\u0433\u043e \u0438\u0437 \u043f\u043e\u043b\u044f <i>length <\/i>(\u043f\u0443\u043d\u043a\u0442 8). \u0412 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0438\u0434\u0451\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u044f\u0447\u0435\u0435\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 (\u043f\u0443\u043d\u043a\u0442 8a \u0438 8b). \u0410 \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0442 \u044f\u0447\u0435\u0435\u043a \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0432\u044b\u0434\u0430\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 <i>undefined<\/i>. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0435\u0446 \u0441\u043f\u0438\u0441\u043a\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u043f\u0443\u043d\u043a\u0442 8e).<\/p>\n<p>  \u041d\u0443, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430, \u0432\u0441\u0451 \u0432\u0441\u0442\u0430\u043b\u043e \u043d\u0430 \u0441\u0432\u043e\u0438 \u043c\u0435\u0441\u0442\u0430, \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0443\u0436\u0435 \u0442\u0443 \u0441\u0430\u043c\u0443\u044e \u043f\u0443\u0441\u0442\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443.<\/p>\n<pre><code class=\"javascript\">let arr = Array.apply(null, new Array(5)).map(function(){ return Array.apply(null,new Array(5)); });  console.log(arr); \/\/ Array(5) [ (5) [\u2026], (5) [\u2026], (5) [\u2026], (5) [\u2026], (5) [\u2026] ] console.log(arr[0]); \/\/ Array(5) [ undefined, undefined, undefined, undefined, undefined ] console.log(Object.getOwnPropertyDescriptor(arr,\"0\")); \/\/ Object { value: (5) [\u2026], writable: true, enumerable: true, configurable: true } console.log(arr[0][0]); \/\/ undefined console.log(Object.getOwnPropertyDescriptor(arr[0],\"0\")); \/\/ Object { value: undefined, writable: true, enumerable: true, configurable: true }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0432\u0441\u0451 \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442: \u043c\u044b, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u043d\u0430\u043c \u0443\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 <i>Array.apply(null, new Array(5))<\/i> \u043c\u0430\u0441\u0441\u0438\u0432 \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0443 map, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043f\u043e \u0442\u0430\u043a\u043e\u043c\u0443 \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0451 \u043f\u0440\u043e\u0449\u0435. \u0412 <i>ECMAScript6<\/i> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>spread <\/i> \u2014 <i>\u2026<\/i>, \u0438, \u0447\u0442\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0431\u0438\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">let arr = new Array(...new Array(5)).map(() =&gt; new Array(...new Array(5)));<\/code><\/pre>\n<p>  \u0438\u043b\u0438 \u0443\u0436 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043c, \u0445\u043e\u0442\u044c \u044f \u0440\u0430\u043d\u0435\u0435 \u0438 \u043e\u0431\u0435\u0449\u0430\u043b new \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0442\u044c\u2026<\/p>\n<pre><code class=\"javascript\">let arr = Array(...Array(5)).map(() =&gt; Array(...Array(5)));<\/code><\/pre>\n<p><i>\u043f\u0440\u0438\u043c.: \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0437 \u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441\u043e spread \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u0438 \u043e\u043d\u0438.<\/i><\/p>\n<p>  \u0412\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b <i>spread <\/i>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043c\u044b \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043e\u0434\u043d\u0430\u043a\u043e, \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b \u043f\u043e\u043b\u0435\u0437\u0435\u043d.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c <i>Function.prototype.apply()<\/i> \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c, \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0441 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0436\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b JavaScript \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u0438\u043c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0438 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0438\u0441\u043e\u043c, \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u043e. \u041d\u0443, \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0443\u0434\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>  \u0418, \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0442\u043e\u043c\u0443 \u0441\u0430\u043c\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u043d\u0430 <i>stackoverflow <\/i>\u2013 \u0442\u0430\u043c, \u044f \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u0432\u0451\u043b \u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c\u0443 \u043e\u0442\u0432\u0435\u0442\u0443, \u0438, \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <i>5\u04455<\/i>, \u043e\u0434\u043d\u0430\u043a\u043e \u2014 \u0442\u0430\u043c \u0437\u0430\u043a\u0440\u0430\u043b\u0430\u0441\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>  \u041e\u043d \u0432\u0431\u0438\u043b:<\/p>\n<p>  <code>Array.apply(null, new Array(5)).map(function(){<br \/>   return new Array(5);<br \/>  });<\/code><\/p>\n<p>  \u041a\u0430\u043a \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u043a\u0430\u043a\u043e\u0439 \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442?<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">console.log(arr); \/\/ Array(5) [ (5) [\u2026], (5) [\u2026], (5) [\u2026], (5) [\u2026], (5) [\u2026] ]<br \/>  console.log(arr[0]); \/\/ Array(5) [ &lt;5 empty slots&gt; ]<br \/>  console.log(Object.getOwnPropertyDescriptor(arr,\u00ab0\u00bb)); \/\/ Object { value: (5) [\u2026], writable: true, enumerable: true, configurable: true }<br \/>  console.log(arr[0][0]); \/\/ undefined<br \/>  console.log(Object.getOwnPropertyDescriptor(arr[0],\u00ab0\u00bb)); \/\/ undefined  <\/div>\n<\/div>\n<p>  \u043d\u0435\u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438, \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043e\u043d \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u2026<\/p>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0438:<\/p>\n<p>  \u2192\u00a0<a href=\"http:\/\/www.ecma-international.org\/ecma-262\/6.0\/\">ECMAScript 2015 Language Specification<\/a><br \/>  \u2192 <a href=\"https:\/\/stackoverflow.com\/questions\/25512771\/what-is-array-apply-actually-doing\/56814230#56814230\">What is Array.apply actually doing<\/a><\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/463041\/\"> https:\/\/habr.com\/ru\/post\/463041\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cf\/uz\/xt\/cfuzxt6gszx356ckhbffnh21g9g.jpeg\" alt=\"image\"><\/div>\n<p>  \u041f\u0430\u0440\u0443 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434 \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 <i>stackoverflow<\/i>, \u0442\u0430\u043c, \u0435\u0441\u043b\u0438 \u0432\u043a\u0440\u0430\u0442\u0446\u0435, \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0445\u043e\u0442\u0435\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <i>5\u04455<\/i>, \u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0443 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u043d\u0435\u0442. \u0412 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0432\u0448\u0435\u0439\u0441\u044f \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0451\u0442 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u044b\u0441\u043b\u0438. <\/p>\n<p>  \u041f\u0440\u0430\u0432\u0434\u0430, \u0437\u0430\u0434\u0430\u0432\u0448\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0442\u0435 \u043a\u0442\u043e \u0435\u043c\u0443 \u043e\u0442\u0432\u0435\u0447\u0430\u043b, \u043d\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d. \u0412\u0441\u0451 \u044d\u0442\u043e \u043c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u043e, \u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u043a\u043e\u043f\u043d\u0443\u0442\u044c \u0447\u0443\u0442\u044c \u0433\u043b\u0443\u0431\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0439\u0442\u0438 \u043a \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0443\u043c\u043e\u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0441 \u0432\u0430\u043c\u0438 \u0438 \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-293162","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=293162"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293162\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=293162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=293162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=293162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}