{"id":133262,"date":"2025-01-18T16:54:05","date_gmt":"2025-01-18T10:54:05","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=133262"},"modified":"2025-01-18T16:56:05","modified_gmt":"2025-01-18T10:56:05","slug":"%d1%84%d1%83%d0%bd%d0%ba%d1%86%d0%b8%d0%b8-%d0%b2-javascript","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=133262","title":{"rendered":"\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 JavaScript"},"content":{"rendered":"<p>\u0412 JavaScript \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0433\u0440\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438. \u041e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<ol>\n<li>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Function Declaration)<\/li>\n<li>\u0410\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Function Expression)<\/li>\n<li>\u0421\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Arrow Function)<\/li>\n<li>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Constructor Function)<\/li>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Generator Functions)<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/li>\n<li>\u0418\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/li>\n<\/ol>\n<p><strong><span style=\"color: #cc66cc;\">1<\/span>. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000;\">Function<\/span> Declaration<span style=\"color: #66cc66;\">)<\/span><\/strong><br \/>\n\u042d\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <span style=\"color: #000000; font-weight: bold;\">function<\/span>. \u0422\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u043e \u0438\u0445 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0443 <span style=\"color: #ff0000;\">&#171;\u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f&#187;<\/span> <span style=\"color: #66cc66;\">(<\/span>hoisting<span style=\"color: #66cc66;\">)<\/span>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p><span style=\"color: #808080; font-style: italic;\">\/\/ \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/span><br \/>\n<span style=\"color: #000000; font-weight: bold;\">function<\/span> greet<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">name<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\nconsole.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>`\u041f\u0440\u0438\u0432\u0435\u0442, $<span style=\"color: #66cc66;\">{<\/span><span style=\"color: #0066cc;\">name<\/span><span style=\"color: #66cc66;\">}<\/span><span style=\"color: #66cc66;\">!<\/span>`<span style=\"color: #66cc66;\">)<\/span>;<br \/>\n<span style=\"color: #66cc66;\">}<\/span><\/p>\n<p>greet<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">&#171;\u0418\u0432\u0430\u043d&#187;<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041f\u0440\u0438\u0432\u0435\u0442, \u0418\u0432\u0430\u043d!<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">2<\/span>. \u0410\u043d\u043e\u043d\u0438\u043c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000;\">Function<\/span> Expression<span style=\"color: #66cc66;\">)<\/span><\/strong><br \/>\n\u0410\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p><span style=\"color: #808080; font-style: italic;\">\/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/span><br \/>\nconst sum = <span style=\"color: #000000; font-weight: bold;\">function<\/span><span style=\"color: #66cc66;\">(<\/span>a, b<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\n<span style=\"color: #b1b100;\">return<\/span> a + b;<br \/>\n<span style=\"color: #66cc66;\">}<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>sum<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">10<\/span>, <span style=\"color: #cc66cc;\">20<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ 30<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">3<\/span>. \u0421\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <span style=\"color: #66cc66;\">(<\/span>Arrow <span style=\"color: #000000;\">Function<\/span><span style=\"color: #66cc66;\">)<\/span><\/strong><br \/>\n\u042d\u0442\u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0431\u044b\u043b \u0432\u0432\u0435\u0434\u0435\u043d \u0432 ES6 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0438 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 <span style=\"color: #0066cc;\">this<\/span>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p><span style=\"color: #808080; font-style: italic;\">\/\/ \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f<\/span><br \/>\nconst multiply = <span style=\"color: #66cc66;\">(<\/span>a, b<span style=\"color: #66cc66;\">)<\/span> =<span style=\"color: #66cc66;\">&gt;<\/span> a <span style=\"color: #66cc66;\">*<\/span> b;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>multiply<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">5<\/span>, <span style=\"color: #cc66cc;\">8<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ 40<\/span><\/p>\n<p><span style=\"color: #808080; font-style: italic;\">\/\/ \u0421\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432<\/span><br \/>\nconst sayHello = <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span> =<span style=\"color: #66cc66;\">&gt;<\/span> console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">&#8216;\u041f\u0440\u0438\u0432\u0435\u0442!&#8217;<\/span><span style=\"color: #66cc66;\">)<\/span>;<br \/>\nsayHello<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041f\u0440\u0438\u0432\u0435\u0442!<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">4<\/span>. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <span style=\"color: #66cc66;\">(<\/span>Constructor <span style=\"color: #000000;\">Function<\/span><span style=\"color: #66cc66;\">)<\/span><\/strong><br \/>\n\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0412 \u043d\u0438\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u0441\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p><span style=\"color: #808080; font-style: italic;\">\/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f-\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440<\/span><br \/>\n<span style=\"color: #000000; font-weight: bold;\">function<\/span> Person<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">name<\/span>, age<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\n<span style=\"color: #0066cc;\">this<\/span>.<span style=\"color: #0066cc;\">name<\/span> = <span style=\"color: #0066cc;\">name<\/span>;<br \/>\n<span style=\"color: #0066cc;\">this<\/span>.<span style=\"color: #006600;\">age<\/span> = age;<\/p>\n<p><span style=\"color: #0066cc;\">this<\/span>.<span style=\"color: #006600;\">greet<\/span> = <span style=\"color: #000000; font-weight: bold;\">function<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\nconsole.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>`\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 $<span style=\"color: #66cc66;\">{<\/span><span style=\"color: #0066cc;\">this<\/span>.<span style=\"color: #0066cc;\">name<\/span><span style=\"color: #66cc66;\">}<\/span>, \u043c\u043d\u0435 $<span style=\"color: #66cc66;\">{<\/span><span style=\"color: #0066cc;\">this<\/span>.<span style=\"color: #006600;\">age<\/span><span style=\"color: #66cc66;\">}<\/span> \u043b\u0435\u0442.`<span style=\"color: #66cc66;\">)<\/span>;<br \/>\n<span style=\"color: #66cc66;\">}<\/span>;<br \/>\n<span style=\"color: #66cc66;\">}<\/span><\/p>\n<p>let ivan = <span style=\"color: #000000; font-weight: bold;\">new<\/span> Person<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">&#171;\u0418\u0432\u0430\u043d&#187;<\/span>, <span style=\"color: #cc66cc;\">25<\/span><span style=\"color: #66cc66;\">)<\/span>;<br \/>\nivan.<span style=\"color: #006600;\">greet<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0418\u0432\u0430\u043d, \u043c\u043d\u0435 25 \u043b\u0435\u0442.<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">5<\/span>. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <span style=\"color: #66cc66;\">(<\/span>Generator <span style=\"color: #000000;\">Function<\/span><span style=\"color: #66cc66;\">)<\/span><\/strong><br \/>\n\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u044b\u0439 \u0432\u0438\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 yield.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p><span style=\"color: #000000; font-weight: bold;\">function<\/span><span style=\"color: #66cc66;\">*<\/span> countToFive<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\n<span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #66cc66;\">(<\/span>let i = <span style=\"color: #cc66cc;\">1<\/span>; i <span style=\"color: #66cc66;\">&lt;<\/span>= <span style=\"color: #cc66cc;\">5<\/span>; i++<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\nyield i;<br \/>\n<span style=\"color: #66cc66;\">}<\/span><br \/>\n<span style=\"color: #66cc66;\">}<\/span><\/p>\n<p>const generator = countToFive<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p><span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #66cc66;\">(<\/span>let value of generator<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\nconsole.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>value<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u0412\u044b\u0432\u0435\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u0430 \u043e\u0442 1 \u0434\u043e 5<\/span><br \/>\n<span style=\"color: #66cc66;\">}<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">6<\/span>. \u041c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong><br \/>\n\u041c\u0435\u0442\u043e\u0434\u044b \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p><span style=\"color: #808080; font-style: italic;\">\/\/ \u041e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c<\/span><br \/>\nconst user = <span style=\"color: #66cc66;\">{<\/span><br \/>\n<span style=\"color: #0066cc;\">name<\/span>: <span style=\"color: #ff0000;\">&#8216;\u0410\u043b\u0435\u043a\u0441\u0435\u0439&#8217;<\/span>,<br \/>\nage: <span style=\"color: #cc66cc;\">28<\/span>,<br \/>\ngreet: <span style=\"color: #000000; font-weight: bold;\">function<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\nconsole.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>`\u041f\u0440\u0438\u0432\u0435\u0442, \u044f $<span style=\"color: #66cc66;\">{<\/span><span style=\"color: #0066cc;\">this<\/span>.<span style=\"color: #0066cc;\">name<\/span><span style=\"color: #66cc66;\">}<\/span>, \u043c\u043d\u0435 $<span style=\"color: #66cc66;\">{<\/span><span style=\"color: #0066cc;\">this<\/span>.<span style=\"color: #006600;\">age<\/span><span style=\"color: #66cc66;\">}<\/span> \u043b\u0435\u0442.`<span style=\"color: #66cc66;\">)<\/span>;<br \/>\n<span style=\"color: #66cc66;\">}<\/span><br \/>\n<span style=\"color: #66cc66;\">}<\/span>;<\/p>\n<p>user.<span style=\"color: #006600;\">greet<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041f\u0440\u0438\u0432\u0435\u0442, \u044f \u0410\u043b\u0435\u043a\u0441\u0435\u0439, \u043c\u043d\u0435 28 \u043b\u0435\u0442.<\/span><\/p><\/blockquote>\n<p><strong>\u0427\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong><br \/>\nJavaScript \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0442\u0430\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<p><strong><span style=\"color: #cc66cc;\">1<\/span>. <span style=\"color: #0066cc;\">Array<\/span>.<span style=\"color: #0066cc;\">prototype<\/span>.<span style=\"color: #006600;\">map<\/span><\/strong><br \/>\n\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const numbers = <span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">1<\/span>, <span style=\"color: #cc66cc;\">2<\/span>, <span style=\"color: #cc66cc;\">3<\/span>, <span style=\"color: #cc66cc;\">4<\/span><span style=\"color: #66cc66;\">]<\/span>;<br \/>\nconst doubledNumbers = numbers.<span style=\"color: #006600;\">map<\/span><span style=\"color: #66cc66;\">(<\/span>num =<span style=\"color: #66cc66;\">&gt;<\/span> num <span style=\"color: #66cc66;\">*<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>doubledNumbers<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ [2, 4, 6, 8]<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">2<\/span>. <span style=\"color: #0066cc;\">Array<\/span>.<span style=\"color: #0066cc;\">prototype<\/span>.<span style=\"color: #006600;\">filter<\/span><\/strong><br \/>\n\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044e, \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439-\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const numbers = <span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">1<\/span>, <span style=\"color: #cc66cc;\">2<\/span>, <span style=\"color: #cc66cc;\">3<\/span>, <span style=\"color: #cc66cc;\">4<\/span>, <span style=\"color: #cc66cc;\">5<\/span>, <span style=\"color: #cc66cc;\">6<\/span><span style=\"color: #66cc66;\">]<\/span>;<br \/>\nconst evenNumbers = numbers.<span style=\"color: #006600;\">filter<\/span><span style=\"color: #66cc66;\">(<\/span>num =<span style=\"color: #66cc66;\">&gt;<\/span> num <span style=\"color: #66cc66;\">%<\/span> <span style=\"color: #cc66cc;\">2<\/span> === <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>evenNumbers<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ [2, 4, 6]<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">3<\/span>. <span style=\"color: #0066cc;\">Array<\/span>.<span style=\"color: #0066cc;\">prototype<\/span>.<span style=\"color: #006600;\">reduce<\/span><\/strong><br \/>\n\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const numbers = <span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">1<\/span>, <span style=\"color: #cc66cc;\">2<\/span>, <span style=\"color: #cc66cc;\">3<\/span>, <span style=\"color: #cc66cc;\">4<\/span><span style=\"color: #66cc66;\">]<\/span>;<br \/>\nconst sum = numbers.<span style=\"color: #006600;\">reduce<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>acc, currentValue<span style=\"color: #66cc66;\">)<\/span> =<span style=\"color: #66cc66;\">&gt;<\/span> acc + currentValue, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>sum<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ 10<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">4<\/span>. <span style=\"color: #0066cc;\">Object<\/span>.<span style=\"color: #006600;\">keys<\/span><\/strong><br \/>\n\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043b\u044e\u0447\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const person = <span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #0066cc;\">name<\/span>: <span style=\"color: #ff0000;\">&#8216;\u0418\u0432\u0430\u043d&#8217;<\/span>, age: <span style=\"color: #cc66cc;\">35<\/span> <span style=\"color: #66cc66;\">}<\/span>;<br \/>\nconst keys = <span style=\"color: #0066cc;\">Object<\/span>.<span style=\"color: #006600;\">keys<\/span><span style=\"color: #66cc66;\">(<\/span>person<span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>keys<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ [&#171;name&#187;, &#171;age&#187;]<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">5<\/span>. <span style=\"color: #006600;\">setTimeout<\/span><\/strong><br \/>\n\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043f\u0443\u0441\u0442\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>setTimeout<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span> =<span style=\"color: #66cc66;\">&gt;<\/span> <span style=\"color: #66cc66;\">{<\/span><br \/>\nconsole.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">&#8216;\u041f\u0440\u0438\u0432\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b!&#8217;<\/span><span style=\"color: #66cc66;\">)<\/span>;<br \/>\n<span style=\"color: #66cc66;\">}<\/span>, <span style=\"color: #cc66cc;\">2000<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">6<\/span>. <span style=\"color: #0066cc;\">Array<\/span>.<span style=\"color: #0066cc;\">prototype<\/span>.<span style=\"color: #006600;\">find<\/span><\/strong><br \/>\n\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044e, \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439-\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u043c. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430\u0439\u0434\u0435\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0438\u043d\u0430\u0447\u0435 \u2014 <span style=\"color: #0066cc;\">undefined<\/span>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const users = <span style=\"color: #66cc66;\">[<\/span><br \/>\n<span style=\"color: #66cc66;\">{<\/span> id: <span style=\"color: #cc66cc;\">1<\/span>, <span style=\"color: #0066cc;\">name<\/span>: <span style=\"color: #ff0000;\">&#8216;\u0418\u0432\u0430\u043d&#8217;<\/span> <span style=\"color: #66cc66;\">}<\/span>,<br \/>\n<span style=\"color: #66cc66;\">{<\/span> id: <span style=\"color: #cc66cc;\">2<\/span>, <span style=\"color: #0066cc;\">name<\/span>: <span style=\"color: #ff0000;\">&#8216;\u0410\u043d\u043d\u0430&#8217;<\/span> <span style=\"color: #66cc66;\">}<\/span>,<br \/>\n<span style=\"color: #66cc66;\">{<\/span> id: <span style=\"color: #cc66cc;\">3<\/span>, <span style=\"color: #0066cc;\">name<\/span>: <span style=\"color: #ff0000;\">&#8216;\u0421\u0435\u0440\u0433\u0435\u0439&#8217;<\/span> <span style=\"color: #66cc66;\">}<\/span><br \/>\n<span style=\"color: #66cc66;\">]<\/span>;<\/p>\n<p>const foundUser = users.<span style=\"color: #006600;\">find<\/span><span style=\"color: #66cc66;\">(<\/span>user =<span style=\"color: #66cc66;\">&gt;<\/span> user.<span style=\"color: #006600;\">id<\/span> === <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>foundUser<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ { id: 2, name: &#8216;\u0410\u043d\u043d\u0430&#8217; }<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">7<\/span>. <span style=\"color: #0066cc;\">String<\/span>.<span style=\"color: #0066cc;\">prototype<\/span>.<span style=\"color: #0066cc;\">split<\/span><\/strong><br \/>\n\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const sentence = <span style=\"color: #ff0000;\">&#171;\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0438\u0440!&#187;<\/span>;<br \/>\nconst words = sentence.<span style=\"color: #0066cc;\">split<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">&#187; &#171;<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>words<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ [&#171;\u041f\u0440\u0438\u0432\u0435\u0442,&#187;, &#171;\u043c\u0438\u0440!&#187;]<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">8<\/span>. <span style=\"color: #0066cc;\">Math<\/span>.<span style=\"color: #0066cc;\">random<\/span><\/strong><br \/>\n\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 <span style=\"color: #cc66cc;\">0<\/span> <span style=\"color: #66cc66;\">(<\/span>\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e<span style=\"color: #66cc66;\">)<\/span> \u0434\u043e <span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">(<\/span>\u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e<span style=\"color: #66cc66;\">)<\/span>. \u042d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const randomNumber = <span style=\"color: #0066cc;\">Math<\/span>.<span style=\"color: #0066cc;\">random<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>randomNumber<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 0.123456789<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">9<\/span>. <span style=\"color: #0066cc;\">Date<\/span>.<span style=\"color: #006600;\">now<\/span><\/strong><br \/>\n\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u044d\u043f\u043e\u0445\u0438 Unix <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> \u044f\u043d\u0432\u0430\u0440\u044f <span style=\"color: #cc66cc;\">1970<\/span> \u0433\u043e\u0434\u0430<span style=\"color: #66cc66;\">)<\/span>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const timestamp = <span style=\"color: #0066cc;\">Date<\/span>.<span style=\"color: #006600;\">now<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>timestamp<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 1677823200000<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">10<\/span>. <span style=\"color: #006600;\">JSON<\/span>.<span style=\"color: #006600;\">stringify<\/span><\/strong><br \/>\n\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 JSON-\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const <span style=\"color: #0066cc;\">data<\/span> = <span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #0066cc;\">name<\/span>: <span style=\"color: #ff0000;\">&#8216;\u0418\u0432\u0430\u043d&#8217;<\/span>, age: <span style=\"color: #cc66cc;\">30<\/span> <span style=\"color: #66cc66;\">}<\/span>;<br \/>\nconst jsonData = JSON.<span style=\"color: #006600;\">stringify<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">data<\/span><span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>jsonData<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ {&#171;name&#187;:&#187;\u0418\u0432\u0430\u043d&#187;,&#187;age&#187;:30}<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">11<\/span>. <span style=\"color: #006600;\">JSON<\/span>.<span style=\"color: #006600;\">parse<\/span><\/strong><br \/>\n\u041f\u0430\u0440\u0441\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const jsonString = <span style=\"color: #ff0000;\">&#8216;{&#171;name&#187;:&#187;\u0418\u0432\u0430\u043d&#187;,&#187;age&#187;:30}&#8217;<\/span>;<br \/>\nconst parsedData = JSON.<span style=\"color: #006600;\">parse<\/span><span style=\"color: #66cc66;\">(<\/span>jsonString<span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>parsedData<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ { name: &#8216;\u0418\u0432\u0430\u043d&#8217;, age: 30 }<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">12<\/span>. <span style=\"color: #006600;\">Promise<\/span>.<span style=\"color: #006600;\">resolve<\/span><\/strong><br \/>\n\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>Promise.<span style=\"color: #006600;\">resolve<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">&#8216;\u041f\u0440\u0438\u0432\u0435\u0442!&#8217;<\/span><span style=\"color: #66cc66;\">)<\/span><br \/>\n.<span style=\"color: #006600;\">then<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">message<\/span> =<span style=\"color: #66cc66;\">&gt;<\/span> console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">message<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041f\u0440\u0438\u0432\u0435\u0442!<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">13<\/span>. <span style=\"color: #006600;\">Promise<\/span>.<span style=\"color: #006600;\">reject<\/span><\/strong><br \/>\n\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>Promise.<span style=\"color: #006600;\">reject<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">new<\/span> <span style=\"color: #0066cc;\">Error<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">&#8216;\u041e\u0448\u0438\u0431\u043a\u0430!&#8217;<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span><br \/>\n.<span style=\"color: #0066cc;\">catch<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">error<\/span> =<span style=\"color: #66cc66;\">&gt;<\/span> console.<span style=\"color: #0066cc;\">error<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">error<\/span>.<span style=\"color: #0066cc;\">message<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u041e\u0448\u0438\u0431\u043a\u0430!<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">14<\/span>. <span style=\"color: #0066cc;\">Array<\/span>.<span style=\"color: #006600;\">isArray<\/span><\/strong><br \/>\n\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const arr = <span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">1<\/span>, <span style=\"color: #cc66cc;\">2<\/span>, <span style=\"color: #cc66cc;\">3<\/span><span style=\"color: #66cc66;\">]<\/span>;<br \/>\nconst isArray = <span style=\"color: #0066cc;\">Array<\/span>.<span style=\"color: #006600;\">isArray<\/span><span style=\"color: #66cc66;\">(<\/span>arr<span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>isArray<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ true<\/span><\/p><\/blockquote>\n<p><strong><span style=\"color: #cc66cc;\">15<\/span>. <span style=\"color: #0066cc;\">Object<\/span>.<span style=\"color: #006600;\">assign<\/span><\/strong><br \/>\n\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<blockquote><p>const obj1 = <span style=\"color: #66cc66;\">{<\/span> a: <span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">}<\/span>;<br \/>\nconst obj2 = <span style=\"color: #66cc66;\">{<\/span> b: <span style=\"color: #cc66cc;\">2<\/span> <span style=\"color: #66cc66;\">}<\/span>;<br \/>\nconst mergedObj = <span style=\"color: #0066cc;\">Object<\/span>.<span style=\"color: #006600;\">assign<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">{<\/span><span style=\"color: #66cc66;\">}<\/span>, obj1, obj2<span style=\"color: #66cc66;\">)<\/span>;<\/p>\n<p>console.<span style=\"color: #0066cc;\">log<\/span><span style=\"color: #66cc66;\">(<\/span>mergedObj<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ { a: 1, b: 2 }<\/span><\/p><\/blockquote>\n<p>\u042d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0438\u0431\u043a\u0438\u043c \u0438 \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f JavaScript, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0441\u043f\u0435\u043a\u0442\u0440 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 JavaScript \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0433\u0440\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438. \u041e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439: \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Function Declaration) \u0410\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Function Expression) \u0421\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Arrow Function) \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Constructor Function) \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Generator Functions) \u041c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0418\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":133226,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[463],"tags":[],"class_list":["post-133262","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript"],"views":374,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/133262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133262"}],"version-history":[{"count":4,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/133262\/revisions"}],"predecessor-version":[{"id":133266,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/133262\/revisions\/133266"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/133226"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133262"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}