{"id":316814,"date":"2021-01-22T21:00:31","date_gmt":"2021-01-22T21:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=316814"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=316814","title":{"rendered":"\u0427\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0432 Node.js 15?"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<blockquote><p>\u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e \u043d\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Node.js.<\/p><\/blockquote>\n<p>  \u0412\u0435\u0440\u0441\u0438\u044f <a href=\"https:\/\/nodejs.org\/en\/blog\/release\/v15.0.0\/\">Node.js 15<\/a> \u0431\u044b\u043b\u0430 \u0432\u044b\u043f\u0443\u0449\u0435\u043d\u0430 20 \u043e\u043a\u0442\u044f\u0431\u0440\u044f 2020 \u0433\u043e\u0434\u0430. \u0421\u0440\u0435\u0434\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\u0440\u0435\u0436\u0438\u043c throw \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f\u0445 <\/li>\n<li>\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430 V8 8.6<\/li>\n<li><a href=\"https:\/\/medium.com\/better-programming\/the-step-by-step-guide-to-understanding-and-adopting-npm-7-914504f7090f\">NPM 7<\/a><\/li>\n<li>\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 QUIC<\/li>\n<li>N-API Version 7<\/li>\n<li>\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430 API \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 (Async Local Storage)<\/li>\n<\/ul>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u0438 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438 \u043a\u0430\u043a \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 NVM \u0434\u043b\u044f \u043e\u0431\u0437\u043e\u0440\u0430 Node<\/h3>\n<p>  \u0412 <a href=\"https:\/\/medium.com\/better-programming\/use-nvm-to-manage-node-js-and-npm-versions-2bd0d0875f9f\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e <a href=\"https:\/\/github.com\/nvm-sh\/nvm\">NVM (Node Version Manager)<\/a> \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 Node.js \u0438 NPM. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u0431\u044b\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b Node.js 12.16.0 \u0438 NPM 6.14.8. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 <b>nvm install node<\/b>, \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 Node.js 15.4.0 \u0438 NPM7.0.15.<\/p>\n<p>  \u0423 \u043d\u0430\u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u0434\u0432\u0430 \u043e\u043a\u043d\u0430, \u0432 \u043e\u0434\u043d\u043e\u043c Node.js 12, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u2014 Node.js 15.<\/p>\n<p>  \u0412 \u043e\u043a\u043d\u0435 <b>node12<\/b>:<\/p>\n<pre><code class=\"bash\">$ nvm use 12 Now using node v12.16.0 (npm v6.14.8)<\/code><\/pre>\n<p>  \u0412 \u043e\u043a\u043d\u0435 <b>node15<\/b>:<\/p>\n<pre><code class=\"bash\">$ nvm use 15 Now using node v15.4.0 (npm v7.0.15)<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044e.<\/p>\n<h3>\u0420\u0435\u0436\u0438\u043c Throw \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u0430 (promise)<\/h3>\n<p>  \u0421\u043e\u0431\u044b\u0442\u0438\u0435 <b>unhandledRejection<\/b> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u043c\u0438\u0441 (promise) \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u043f\u0440\u043e\u043c\u0438\u0441\u0443 \u0432 \u0445\u043e\u0434\u0435 \u0446\u0438\u043a\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 Node.js 15, \u0440\u0435\u0436\u0438\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f <b>unhandledRejection<\/b> \u0431\u044b\u043b \u0438\u0437\u043c\u0435\u043d\u0435\u043d \u0441 <b>warn<\/b> \u043d\u0430 <b>throw<\/b>. \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 <b>throw<\/b>, \u0435\u0441\u043b\u0438 \u0445\u0443\u043a <b>unhandledRejection<\/b> \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, <b>unhandledRejection<\/b> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043d\u0435 \u043f\u043e\u0439\u043c\u0430\u043d\u043d\u043e\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <b>catch<\/b>.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043c\u0438\u0441 \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u043b\u0441\u044f (rejected) \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">function myPromise() {   new Promise((_, reject) =&gt;     setTimeout(       () =&gt;         reject({           error: 'The call is rejected with an error',         }),       1000     )   ).then((data) =&gt; console.log(data.data)); }  myPromise();<\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u043e\u043a\u043d\u0435 <b>node12<\/b>, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"bash\">$ node myPromise.js (node:79104) UnhandledPromiseRejectionWarning: #&lt;Object&gt; (node:79104) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https:\/\/nodejs.org\/api\/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:79104) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.Users that have an unhandledRejection hook should see no change in behavior, and it\u2019s still possible to switch modes using the --unhandled-rejections=mode process flag.<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u043e\u043a\u043d\u0435 <b>node15<\/b> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 <b>UnhandledPromiseRejection<\/b>:<\/p>\n<pre><code class=\"bash\">$ node myPromise.js node:internal\/process\/promises:227           triggerUncaughtException(err, true \/* fromPromise *\/);           ^[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason &quot;#&lt;Object&gt;&quot;.] {   code: 'ERR_UNHANDLED_REJECTION' }<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u0432\u0435\u0442\u0432\u044c <b>then<\/b> \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435 \u043a\u043e\u0434\u0435 (<b>.catch((<\/b>error<b>) =&gt; console.log(<\/b>error<b>.error))<\/b> \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442).<\/p>\n<pre><code class=\"javascript\">function myPromise() {   new Promise((_, reject) =&gt;     setTimeout(       () =&gt;         reject({           error: 'The call is rejected with an error',         }),       1000     )   ).then(     (data) =&gt; console.log(data.data),     (error) =&gt; console.log(error.error)   ); }  myPromise();<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u043e\u043a\u043d\u0430\u0445 (<b>node12<\/b> \u0438 <b>node15<\/b>):<\/p>\n<pre><code class=\"bash\">$ node myPromise.js The call is rejected with an error<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u043b\u043e\u0432\u044f\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c catch. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0445\u0443\u043a unhandledRejection \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<pre><code class=\"javascript\">function myPromise() {   new Promise((_, reject) =&gt;     setTimeout(       () =&gt;         reject({           error: 'The call is rejected with an error',         }),       1000     )   ).then((data) =&gt; console.log(data.data)); }  myPromise();  process.on('unhandledRejection', (reason, promise) =&gt; {   console.log('reason is', reason);   console.log('promise is', promise);   \/\/ Application specific logging, throwing an error, or other logic here });<\/code><\/pre>\n<p>  \u0425\u0443\u043a <b>unhandledRejection<\/b> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0432 Node.js 12, \u0442\u0430\u043a \u0438 \u0432 Node.js 15. \u041f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, <b>unhandledRejection<\/b> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e.<\/p>\n<pre><code class=\"bash\">$ node myPromise.js reason is { error: 'The call is rejected with an error' } promise is Promise { &lt;rejected&gt; { error: 'The call is rejected with an error' } }<\/code><\/pre>\n<p>  <\/p>\n<h3>V8 8.6 \u041d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430<\/h3>\n<p>  V8, \u0434\u0432\u0438\u0436\u043e\u043a JavaScript, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d \u0441 8.4 \u0434\u043e 8.6. \u0432\u0435\u0440\u0441\u0438\u0438. \u041f\u043e\u043c\u0438\u043c\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f V8 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438:<\/p>\n<ul>\n<li><b>Promise.any()<\/b> \u0438 <b>AggregateError<\/b> (\u0438\u0437 V8 8.5)<\/li>\n<li><b>await setTimeout<\/b> \u0438 <b>AbortController<\/b> (\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0438\u0447\u0430)<\/li>\n<li><b>String.prototype.replaceAll()<\/b> (\u0438\u0437 V8 8.5)<\/li>\n<li>\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f <b>&amp;&amp;=<\/b>, <b>||=<\/b> \u0438 <b>??=<\/b> (\u0438\u0437 V8 8.5)<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>Promise.any() \u0438 AggregateError<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <b>Promise.all()<\/b>.<\/p>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Promise\/all\">Promise.all()<\/a> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u0438\u0437 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u043c\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <b>Promise.all()<\/b> \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 (resolved) \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">function myPromise(delay) {   return new Promise((resolve) =&gt;     setTimeout(       () =&gt;         resolve({           data: The data from ${delay} ms delay,         }),       delay     )   ); }  async function getData() {   try {     const data = await Promise.all([myPromise(5000), myPromise(100)]);     console.log(data);   } catch (error) {     console.log(error);   } }  getData(); <\/code><\/pre>\n<p>  <b>Promise.all()<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u043c\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0440\u043e\u043c\u0438\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u044b (resolved), \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 iterable \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0439:<\/p>\n<pre><code class=\"bash\">$ node myPromise.js [   { data: 'The data from 5000 ms delay' },   { data: 'The data from 100 ms delay' } ]<\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <b>Promise.all()<\/b> \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043d\u044b\u0445 (rejected) \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432.<\/p>\n<pre><code class=\"javascript\">function myPromise(delay) {   return new Promise((_, reject) =&gt;     setTimeout(       () =&gt;         reject({           error: The error from ${delay} ms delay,         }),       delay     )   ); }  async function getData() {   try {     const data = await Promise.all([myPromise(5000), myPromise(100)]);     console.log(data);   } catch (error) {     console.log(error);   } }  getData();<\/code><\/pre>\n<p>  <b>Promise.all()<\/b> \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0435\u0434\u0436\u0435\u043a\u0442 \u043d\u0430 \u043b\u044e\u0431\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0438\u0441\u0430 \u0438\u043b\u0438 \u043d\u0430 \u043b\u044e\u0431\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u044d\u0442\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0435:<\/p>\n<pre><code class=\"bash\">$ node myPromise.js { error: 'The error from 100 ms delay' }<\/code><\/pre>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Promise\/any\">Promise.any()<\/a> \u2014 \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 Node.js 15. \u041e\u043d \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434\u0443 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Promise\/all\">Promise.all()<\/a>. Promise.any() \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u201c\u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0439\u201d Promise. \u0418, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0439 Promise \u0432 iterable \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0438\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0438\u0441 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u00ab\u043e\u0431\u0435\u0449\u0430\u043d\u0438\u044f\u00bb.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <b>Promise.any()<\/b> \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 (resolved) \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">function myPromise(delay) {   return new Promise((resolve) =&gt;     setTimeout(       () =&gt;         resolve({           data: The error from ${delay} ms delay,         }),       delay     )   ); }  async function getData() {   try {     const data = await Promise.any([myPromise(5000), myPromise(100)]);     console.log(data);   } catch (error) {     console.log(error);     console.log(error.errors);   } }  getData();<\/code><\/pre>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Promise\/any\">Promise.any()<\/a> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 (resolved) \u043f\u0440\u043e\u043c\u0438\u0441:<\/p>\n<pre><code class=\"bash\">$ node myPromise.js { data: 'The error from 100 ms delay' }<\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <b>Promise.any()<\/b> \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043d\u044b\u0445 (rejected) \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">function myPromise(delay) {   return new Promise((_, reject) =&gt;     setTimeout(       () =&gt;         reject({           error: The error from ${delay} ms delay,         }),       delay     )   ); }  async function getData() {   try {     const data = await Promise.any([myPromise(5000), myPromise(100)]);     console.log(data);   } catch (error) {     console.log(error);     console.log(error.errors);   } }  getData();<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u044b \u0432 iterable \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0442.\u0435. \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u043c\u0438\u0441\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u044e\u0442\u0441\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0438\u0441 \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442\u0441\u044f \u0441 <b>AggregateError<\/b>, \u043d\u043e\u0432\u044b\u043c \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u043e\u043c <b>Error<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"bash\">$ node myPromise.js [AggregateError: All promises were rejected] [   { error: 'The error from 5000 ms delay' },   { error: 'The error from 100 ms delay' } ]<\/code><\/pre>\n<p>  <\/p>\n<h4>Await setTimeout \u0438 AbortController<\/h4>\n<p>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 <b>setTimeout<\/b> \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u0430. <\/p>\n<p>  <b>SetTimeout<\/b> \u0432 <b>WindowOrWorkerGlobalScope<\/b>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043e\u043b\u043b\u0431\u044d\u043a. \u041e\u0434\u043d\u0430\u043a\u043e <b>timers\/promises<\/b> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u0440\u043e\u043c\u0438\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <b>setTimeout<\/b>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 async\/await.<\/p>\n<pre><code class=\"javascript\">const { setTimeout } = require('timers\/promises');  async function myPromise(delay) {   await setTimeout(delay);   return new Promise((resolve) =&gt; {     resolve({       data: The data from ${delay} ms delay,     });   }); }  async function getData() {   try {     const data = await Promise.any([myPromise(5000), myPromise(100)]);     console.log(data);   } catch (error) {     console.log(error);     console.log(error.errors);   } }  getData();<\/code><\/pre>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/AbortController\">AbortController<\/a> \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 JavaScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0440\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0431-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e. \u041c\u044b \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <b>AbortController<\/b> \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e <a href=\"https:\/\/medium.com\/better-programming\/the-power-and-convenience-of-useasync-e4a3e4934143\">useAsync<\/a>.<\/p>\n<p>  \u0418 <b>await setTimeout<\/b>, \u0438 <b>AbortController<\/b> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438.<\/p>\n<h4>String.prototype.replaceAll()<\/h4>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <b>String.prototype.replace()<\/b>.<\/p>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/String\/replace\">replace()<\/a> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0438\u043b\u0438 \u0432\u0441\u0435\u043c\u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c, \u0437\u0430\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c. \u0428\u0430\u0431\u043b\u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438\u043b\u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c. \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u043e\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"bash\">'20+1+2+3'.replace('+', '-');<\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u0430\u0441\u0442 <b>\u201c20\u20131+2+3\u201d<\/b>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u00ab+\u00bb \u043d\u0430 \u00ab-\u00bb, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"bash\">'20+1+2+3'.replace(\/\\+\/g, '-');<\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u0430\u0441\u0442 <b>\u201c20\u20131-2-3\u201d<\/b>.<\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/String\/replaceAll\">replaceAll()<\/a> \u2014 \u043d\u043e\u0432\u0438\u043d\u043a\u0430 \u0432 Node.js 15. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e, \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c, \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c. \u0428\u0430\u0431\u043b\u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438\u043b\u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c, \u0430 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0442\u043e\u0434\u0443 <b>replaceAll()<\/b>, \u043d\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0432\u0441\u0435\u0445 \u00ab+\u00bb \u043d\u0430 \u00ab-\u00bb.<\/p>\n<pre><code class=\"bash\">'20+1+2+3'.replaceAll('+', '-');<\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u0430\u0435\u0442 <b>\u201c20\u20131-2-3\u201d<\/b>.<\/p>\n<h4>\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f &amp;&amp;=, ||= \u0438 ??=<\/h4>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/Logical_AND_assignment\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f AND<\/a> (<b>x &amp;&amp;= y<\/b>) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 x \u0438\u0441\u0442\u0438\u043d\u043d\u043e.<\/p>\n<p>  <b> x &amp;&amp;= y<\/b> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <b>x &amp;&amp; (x = y)<\/b>, \u043d\u043e \u043d\u0435 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <b>x = x &amp;&amp; y<\/b>.<\/p>\n<pre><code class=\"javascript\">let x = 0; let y = 1;  x &amp;&amp;= 0; \/\/ 0 x &amp;&amp;= 1; \/\/ 0 y &amp;&amp;= 1; \/\/ 1 y &amp;&amp;= 0; \/\/ 0<\/code><\/pre>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/Logical_OR_assignment\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f OR<\/a> (x ||= y) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 x \u043b\u043e\u0436\u043d\u043e. <\/p>\n<p>  <b>x || = y<\/b> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <b>x || (x = y)<\/b>, \u043d\u043e \u043d\u0435 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <b>x = x || \u0443<\/b>.<\/p>\n<pre><code class=\"javascript\">let x = 0; let y = 1;  x ||= 0; \/\/ 0 x ||= 1; \/\/ 1 y ||= 1; \/\/ 1 y ||= 0; \/\/ 1<\/code><\/pre>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/Logical_nullish_assignment\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f nullish<\/a> (x ?? = y) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 x \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NULL (<b>null<\/b> \u0438\u043b\u0438 <b>undefined<\/b>). <\/p>\n<p>  <b>x ??= y<\/b> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <b>x ?? (x = y)<\/b>, \u0438 \u043d\u0435 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <b>x = x ?? \u0443<\/b>.<\/p>\n<pre><code class=\"javascript\">let x = undefined; let y = '';  x ??= null; \/\/ null x ??= 'a value'; \/\/ &quot;a value&quot; y ??= undefined; \/\/ &quot;&quot; y ??= null; \/\/ &quot;&quot;<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0414\u0440\u0443\u0433\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h3>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0440\u0435\u0436\u0438\u043c\u0430 <b>throw<\/b> \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u0430 \u0438 \u043d\u043e\u0432\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u0444\u0438\u0447 V8 8.6, \u0432 Node.js 15 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p>  <b>NPM 7<\/b>: \u041c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043e\u0434\u043d\u043e\u0440\u0430\u043d\u0433\u043e\u0432\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 yarn.lock \u0444\u0430\u0439\u043b\u043e\u0432, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438 \u0434\u0440. \u0412\u0441\u0435 \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e <a href=\"https:\/\/medium.com\/better-programming\/the-step-by-step-guide-to-understanding-and-adopting-npm-7-914504f7090f\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>  <b>QUIC<\/b>: \u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f UDP, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c \u0434\u043b\u044f HTTP \/ 3. QUIC \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0441 TLS 1.3, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u043c, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a, \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>  <b>N-API Version 7<\/b>: API \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0430\u0434\u0434\u043e\u043d\u043e\u0432. \u041d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0440\u0435\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f JavaScript, \u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435, \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0433\u043e Node.js.<\/p>\n<p>  <b>\u0423\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 API \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 (Async Local Storage)<\/b>: \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0444\u0438\u0447 \u0434\u043b\u044f \u043a\u0440\u0443\u043f\u043d\u043e\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Node.js 15 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0431\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u0432\u0430\u0441.<\/p><\/div>\n<p> \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\/company\/timeweb\/blog\/538782\/\"> https:\/\/habr.com\/ru\/company\/timeweb\/blog\/538782\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<blockquote><p>\u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e \u043d\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Node.js.<\/p><\/blockquote>\n<p>  \u0412\u0435\u0440\u0441\u0438\u044f <a href=\"https:\/\/nodejs.org\/en\/blog\/release\/v15.0.0\/\">Node.js 15<\/a> \u0431\u044b\u043b\u0430 \u0432\u044b\u043f\u0443\u0449\u0435\u043d\u0430 20 \u043e\u043a\u0442\u044f\u0431\u0440\u044f 2020 \u0433\u043e\u0434\u0430. \u0421\u0440\u0435\u0434\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\u0440\u0435\u0436\u0438\u043c throw \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f\u0445 <\/li>\n<li>\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430 V8 8.6<\/li>\n<li><a href=\"https:\/\/medium.com\/better-programming\/the-step-by-step-guide-to-understanding-and-adopting-npm-7-914504f7090f\">NPM 7<\/a><\/li>\n<li>\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 QUIC<\/li>\n<li>N-API Version 7<\/li>\n<li>\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430 API \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 (Async Local Storage)<\/li>\n<\/ul>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u0438 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438 \u043a\u0430\u043a \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\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-316814","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316814","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=316814"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316814\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}