{"id":9471,"date":"2026-09-24T09:00:00","date_gmt":"2026-09-24T09:00:00","guid":{"rendered":"https:\/\/otus.ru\/journal\/?p=9471"},"modified":"2026-09-25T15:25:17","modified_gmt":"2026-09-25T15:25:17","slug":"tajmer-osobennosti-razrabotki-i-primer-koda","status":"publish","type":"post","link":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/","title":{"rendered":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430"},"content":{"rendered":"<p><strong>\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/strong> &#8212; \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0441\u0440\u0430\u0437\u0443, \u0430 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u043e\u0434\u0438\u043d \u0440\u0430\u0437) \u0438\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c. \u0412 JavaScript \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code> (\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a), <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code> (\u043f\u043e\u0432\u0442\u043e\u0440) \u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">requestAnimationFrame<\/code> (\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439 \u043a\u0430\u0434\u0440\u0430 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435). \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u043d\u0438\u0445 &#8212; \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f, \u0430 \u043d\u0435 \u0442\u043e\u0447\u043d\u0430\u044f: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0437\u0436\u0435.<\/p>\n<div class=\"oj-toc\" style=\"background:#f6f6f6;border-radius:8px;padding:14px 20px;margin:20px 0\">\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/strong><\/p>\n<ol>\n<li><a href=\"#s1\">\u041c\u0438\u043d\u0438-\u0441\u043b\u043e\u0432\u0430\u0440\u044c<\/a><\/li>\n<li><a href=\"#s2\">setTimeout \u0438 clearTimeout: \u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u043e\u0442\u043c\u0435\u043d\u0430<\/a><\/li>\n<li><a href=\"#s3\">\u041f\u043e\u0442\u0435\u0440\u044f this \u0432 \u043a\u043e\u043b\u0431\u044d\u043a\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u0430<\/a><\/li>\n<li><a href=\"#s4\">setInterval \u0438 clearInterval: \u043f\u043e\u0432\u0442\u043e\u0440 \u0441 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c<\/a><\/li>\n<li><a href=\"#s5\">\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 setTimeout \u043f\u0440\u043e\u0442\u0438\u0432 setInterval<\/a><\/li>\n<li><a href=\"#s6\">\u041d\u0443\u043b\u0435\u0432\u0430\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/a><\/li>\n<li><a href=\"#s7\">\u041f\u0430\u0443\u0437\u0430 \u0447\u0435\u0440\u0435\u0437 await<\/a><\/li>\n<li><a href=\"#s8\">\u041f\u0440\u0438\u043c\u0435\u0440: \u0442\u0430\u0439\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430<\/a><\/li>\n<li><a href=\"#s9\">requestAnimationFrame: \u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"#s10\">\u041a\u0430\u043a\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c<\/a><\/li>\n<li><a href=\"#s11\">\u0412\u044b\u0432\u043e\u0434\u044b<\/a><\/li>\n<li><a href=\"#s12\">\u0413\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \/ \u0441\u0432\u044f\u0437\u044c \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a><\/li>\n<li><a href=\"#s13\">FAQ<\/a><\/li>\n<\/ol>\n<\/div>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0438\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b \u0432 Node.js 24 LTS; \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b (DOM, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">requestAnimationFrame<\/code>) \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<h2 id=\"s1\">\u041c\u0438\u043d\u0438-\u0441\u043b\u043e\u0432\u0430\u0440\u044c<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u0422\u0435\u0440\u043c\u0438\u043d<\/th>\n<th>\u0427\u0442\u043e \u044d\u0442\u043e<\/th>\n<th>\u041f\u0440\u0438\u043c\u0435\u0440<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 (delay)<\/td>\n<td>\u0412\u0440\u0435\u043c\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430, 1000 \u043c\u0441 = 1 \u0441<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout(fn, 1000)<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u0430\u0439\u043c\u0435\u0440\u0430<\/td>\n<td>\u0422\u043e, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432; \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043e\u0442\u043c\u0435\u043d\u044b<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">const id = setTimeout(...)<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b<\/td>\n<td>\u041f\u0435\u0440\u0438\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043c\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0442\u0430\u0439\u043c\u0435\u0440\u0430<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval(fn, 1000)<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u0426\u0438\u043a\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (event loop)<\/td>\n<td>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0435\u0440\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u0434 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0443<\/td>\n<td>\u043a\u043e\u043b\u0431\u044d\u043a \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0436\u0434\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 ECMAScript: \u0438\u0445 \u0434\u0430\u0435\u0442 \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTML, Node.js &#8212; \u0441\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">timers<\/code>). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0438\u0436\u0435 \u044d\u0442\u043e \u043e\u0433\u043e\u0432\u043e\u0440\u0435\u043d\u043e.<\/p>\n<h2 id=\"s2\">setTimeout \u0438 clearTimeout: \u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u043e\u0442\u043c\u0435\u043d\u0430<\/h2>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout(\u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430, ...\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b)<\/code>. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0412\u044b\u0437\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearTimeout(id)<\/code> \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a.<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">greet<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">name<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">punctuation<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`\u041f\u0440\u0438\u0432\u0435\u0442, ${<\/span><span style=\"color: #E06C75\">name<\/span><span style=\"color: #98C379\">}${<\/span><span style=\"color: #E06C75\">punctuation<\/span><span style=\"color: #98C379\">}`<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">t1<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">greet<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #D19A66\">1000<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\"\u0410\u043d\u043d\u0430\"<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\"!\"<\/span><span style=\"color: #ABB2BF\">);   <\/span><span style=\"color: #7F848E\">\/\/ \u0447\u0435\u0440\u0435\u0437 ~1 \u0441<\/span>\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">t2<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">greet<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #D19A66\">500<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\"\u0411\u043e\u0440\u0438\u0441\"<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\".\"<\/span><span style=\"color: #ABB2BF\">);   <\/span><span style=\"color: #7F848E\">\/\/ \u0447\u0435\u0440\u0435\u0437 ~0,5 \u0441<\/span>\n\n<span style=\"color: #E06C75\">clearTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">t2<\/span><span style=\"color: #ABB2BF\">);                                   <\/span><span style=\"color: #7F848E\">\/\/ \u0411\u043e\u0440\u0438\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d<\/span>\n<span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0422\u0430\u0439\u043c\u0435\u0440\u044b \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u044b\"<\/span><span style=\"color: #ABB2BF\">);<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">\u0422\u0430\u0439\u043c\u0435\u0440\u044b \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u044b\n\u041f\u0440\u0438\u0432\u0435\u0442, \u0410\u043d\u043d\u0430!\n<\/code><\/pre>\n<p>\u0421\u0442\u0440\u043e\u043a\u0430 \u00ab\u0422\u0430\u0439\u043c\u0435\u0440\u044b \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u044b\u00bb \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0439: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code> \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0432\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435. \u0412\u0442\u043e\u0440\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 \u043e\u0442\u043c\u0435\u043d\u0435\u043d \u0434\u043e \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0411\u043e\u0440\u0438\u0441 \u043d\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0427\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c &#8212; \u0442\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u0440\u0430\u0432\u043d\u0430 0. \u0412 Node.js \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 1 \u043c\u0441 (\u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">NaN<\/code>) \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 1 \u043c\u0441.<\/li>\n<li>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 2 147 483 647 \u043c\u0441 (\u043e\u043a\u043e\u043b\u043e 24,8 \u0441\u0443\u0442\u043e\u043a) \u043d\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 32-\u0431\u0438\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u0412 Node.js 24 \u0442\u0430\u043a\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">TimeoutOverflowWarning: ... Timeout duration was set to 1<\/code>.<\/li>\n<li>\u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430, \u043d\u043e \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">eval<\/code> \u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u043e\u0439 CSP. \u0412 Node.js 24 \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">ERR_INVALID_ARG_TYPE<\/code>. \u041f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/li>\n<li>\u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 &#8212; \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0432 Node.js &#8212; \u043e\u0431\u044a\u0435\u043a\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Timeout<\/code>. \u0425\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0433\u043e \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearTimeout<\/code>, \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u0442\u0438\u043f.<\/li>\n<\/ul>\n<h2 id=\"s3\">\u041f\u043e\u0442\u0435\u0440\u044f this \u0432 \u043a\u043e\u043b\u0431\u044d\u043a\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u0430<\/h2>\n<p>\u0427\u0430\u0441\u0442\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 &#8212; \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0431\u0435\u0437 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438. \u041d\u0435\u0432\u0435\u0440\u043d\u043e:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">counter<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">label<\/span><span style=\"color: #56B6C2\">:<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\"\u0421\u0447\u0435\u0442\u0447\u0438\u043a\"<\/span><span style=\"color: #ABB2BF\">,<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">count<\/span><span style=\"color: #56B6C2\">:<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">,<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">tick<\/span><span style=\"color: #ABB2BF\">() {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">this<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">count<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`${<\/span><span style=\"color: #C678DD\">this<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">label<\/span><span style=\"color: #98C379\">}: ${<\/span><span style=\"color: #C678DD\">this<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">count<\/span><span style=\"color: #98C379\">}`<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  },<\/span>\n<span style=\"color: #ABB2BF\">};<\/span>\n\n<span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">counter<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">tick<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">);<\/span><\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 Node.js 24:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">undefined: NaN\n<\/code><\/pre>\n<p>\u0422\u0430\u0439\u043c\u0435\u0440 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">this<\/code> &#8212; \u0443\u0436\u0435 \u043d\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">counter<\/code> (\u0432 Node.js \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Timeout<\/code>, \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 &#8212; <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">window<\/code>). \u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 &#8212; \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0438\u043b\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0447\u0435\u0440\u0435\u0437 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">bind<\/code>:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(() =&gt; <\/span><span style=\"color: #E06C75\">counter<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">tick<\/span><span style=\"color: #ABB2BF\">(), <\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">);        <\/span><span style=\"color: #7F848E\">\/\/ \u0432\u0430\u0440\u0438\u0430\u043d\u0442 1: \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u0430\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u0430<\/span>\n<span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">counter<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">tick<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">bind<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">counter<\/span><span style=\"color: #ABB2BF\">), <\/span><span style=\"color: #D19A66\">200<\/span><span style=\"color: #ABB2BF\">);  <\/span><span style=\"color: #7F848E\">\/\/ \u0432\u0430\u0440\u0438\u0430\u043d\u0442 2: bind<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">\u0421\u0447\u0435\u0442\u0447\u0438\u043a: 1\n\u0421\u0447\u0435\u0442\u0447\u0438\u043a: 2\n<\/code><\/pre>\n<p>\u0412 \u0441\u0442\u0430\u0440\u043e\u043c \u043a\u043e\u0434\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">$.proxy()<\/code> \u0438\u0437 jQuery &#8212; \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0435\u0433\u043e \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">bind<\/code> \u0438\u043b\u0438 \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f.<\/p>\n<h2 id=\"s4\">setInterval \u0438 clearInterval: \u043f\u043e\u0432\u0442\u043e\u0440 \u0441 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c<\/h2>\n<p><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0435 \u0436\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u043f\u043e\u043a\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442 \u0447\u0435\u0440\u0435\u0437 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearInterval<\/code>.<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">ticks<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">id<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">setInterval<\/span><span style=\"color: #ABB2BF\">(() =&gt; {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">ticks<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`\u0422\u0438\u043a ${<\/span><span style=\"color: #E06C75\">ticks<\/span><span style=\"color: #98C379\">}`<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">ticks<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">===<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">3<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">clearInterval<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">id<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  }<\/span>\n<span style=\"color: #ABB2BF\">}, <\/span><span style=\"color: #D19A66\">1000<\/span><span style=\"color: #ABB2BF\">);<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 (\u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">\u0422\u0438\u043a 1\n\u0422\u0438\u043a 2\n\u0422\u0438\u043a 3\n\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\n<\/code><\/pre>\n<p>\u0417\u0430\u0431\u044b\u0442\u044b\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearInterval<\/code> &#8212; \u0442\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0443\u0442\u0435\u0447\u043a\u0430: \u043f\u043e\u043a\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0430\u043a\u0442\u0438\u0432\u0435\u043d, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0430 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f, \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u0432 Node.js \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 \u0435\u0449\u0435 \u0438 \u043d\u0435 \u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f.<\/p>\n<h2 id=\"s5\">\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 setTimeout \u043f\u0440\u043e\u0442\u0438\u0432 setInterval<\/h2>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0446\u0435\u043f\u043e\u0447\u043a\u043e\u0439: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0430\u043c\u0443 \u0441\u0435\u0431\u044f. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u0438\u0434\u043d\u0430, \u0435\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043b\u0431\u044d\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f. \u0412 \u0442\u0435\u0441\u0442\u0435 \u043d\u0438\u0436\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u00ab\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00bb 60 \u043c\u0441 \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 100 \u043c\u0441:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">busy<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">ms<\/span><span style=\"color: #ABB2BF\">) {               <\/span><span style=\"color: #7F848E\">\/\/ \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u0442\u044f\u0436\u0435\u043b\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u043e\u043a<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">end<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">ms<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">while<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">end<\/span><span style=\"color: #ABB2BF\">) {}<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">start<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">();<\/span>\n<span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">n<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">id<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">setInterval<\/span><span style=\"color: #ABB2BF\">(() =&gt; {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">n<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`interval ${<\/span><span style=\"color: #E06C75\">n<\/span><span style=\"color: #98C379\">}: ${<\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">start<\/span><span style=\"color: #98C379\">} \u043c\u0441`<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">busy<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">60<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">n<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">===<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">4<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #E06C75\">clearInterval<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">id<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">}, <\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">);<\/span>\n\n<span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(() =&gt; {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">s2<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">();<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">m<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">step<\/span><span style=\"color: #ABB2BF\">() {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">m<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`nested ${<\/span><span style=\"color: #E06C75\">m<\/span><span style=\"color: #98C379\">}: ${<\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">s2<\/span><span style=\"color: #98C379\">} \u043c\u0441`<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">busy<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">60<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">m<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">4<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">step<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  }<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">step<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">}, <\/span><span style=\"color: #D19A66\">600<\/span><span style=\"color: #ABB2BF\">);<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u0430 (\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u043c\u0438):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">interval 1: 101 \u043c\u0441\ninterval 2: 202 \u043c\u0441\ninterval 3: 302 \u043c\u0441\ninterval 4: 403 \u043c\u0441\nnested 1: 101 \u043c\u0441\nnested 2: 262 \u043c\u0441\nnested 3: 422 \u043c\u0441\nnested 4: 583 \u043c\u0441\n<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code><\/th>\n<th>\u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0427\u0442\u043e \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 100 \u043c\u0441<\/td>\n<td>\u041f\u0435\u0440\u0438\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0440\u0442\u0430\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/td>\n<td>\u041f\u0430\u0443\u0437\u0443 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043d\u0446\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u043c<\/td>\n<\/tr>\n<tr>\n<td>\u041f\u0430\u0443\u0437\u0430 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b<\/td>\n<td>100 &#8212; 60 = 40 \u043c\u0441<\/td>\n<td>100 \u043c\u0441<\/td>\n<\/tr>\n<tr>\n<td>\u0415\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0434\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430<\/td>\n<td>\u0412\u044b\u0437\u043e\u0432\u044b \u0438\u0434\u0443\u0442 \u043f\u043e\u0434\u0440\u044f\u0434 \u0431\u0435\u0437 \u043f\u0430\u0443\u0437\u044b<\/td>\n<td>\u041f\u0430\u0443\u0437\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f<\/td>\n<\/tr>\n<tr>\n<td>\u041c\u0435\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u043d\u0430 \u0445\u043e\u0434\u0443<\/td>\n<td>\u041d\u0435\u043b\u044c\u0437\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0442\u044c<\/td>\n<td>\u041c\u043e\u0436\u043d\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0412\u044b\u0432\u043e\u0434: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code> \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043b\u0435\u0433\u043a\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code> &#8212; \u043a\u043e\u0433\u0434\u0430 \u0448\u0430\u0433 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0442\u044f\u043d\u0443\u0442\u044c\u0441\u044f \u0438\u043b\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<h3>\u041e\u043f\u0440\u043e\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0443\u0437\u044b<\/h3>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 &#8212; \u043f\u043e\u0432\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u0440\u0430\u0441\u0442\u0443\u0449\u0435\u0439 \u043f\u0430\u0443\u0437\u043e\u0439, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d. \u0417\u0434\u0435\u0441\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043d, \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u043f\u0430\u0443\u0437\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0430 \u0434\u043e 100 \u043c\u0441 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">calls<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">fetchStatus<\/span><span style=\"color: #ABB2BF\">() {           <\/span><span style=\"color: #7F848E\">\/\/ \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0430\u0434\u0430\u044e\u0442<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">calls<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">calls<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&lt;=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">3<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">?<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Promise<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">reject<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #56B6C2\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Error<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"503\"<\/span><span style=\"color: #ABB2BF\">)) <\/span><span style=\"color: #56B6C2\">:<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Promise<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">resolve<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"ok\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">MAX<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">800<\/span><span style=\"color: #ABB2BF\">;                   <\/span><span style=\"color: #7F848E\">\/\/ \u043f\u043e\u0442\u043e\u043b\u043e\u043a \u043f\u0430\u0443\u0437\u044b, \u043c\u0441<\/span>\n<span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">delay<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">;                   <\/span><span style=\"color: #7F848E\">\/\/ \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 5000<\/span>\n<span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">attempts<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">start<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">();<\/span>\n\n<span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">poll<\/span><span style=\"color: #ABB2BF\">() {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">attempts<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">fetchStatus<\/span><span style=\"color: #ABB2BF\">()<\/span>\n<span style=\"color: #ABB2BF\">    .<\/span><span style=\"color: #E06C75\">then<\/span><span style=\"color: #ABB2BF\">((<\/span><span style=\"color: #E06C75\">status<\/span><span style=\"color: #ABB2BF\">) =&gt; <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`${<\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">start<\/span><span style=\"color: #98C379\">} \u043c\u0441: \u043e\u0442\u0432\u0435\u0442 ${<\/span><span style=\"color: #E06C75\">status<\/span><span style=\"color: #98C379\">}`<\/span><span style=\"color: #ABB2BF\">))<\/span>\n<span style=\"color: #ABB2BF\">    .<\/span><span style=\"color: #C678DD\">catch<\/span><span style=\"color: #ABB2BF\">((<\/span><span style=\"color: #E06C75\">err<\/span><span style=\"color: #ABB2BF\">) =&gt; {<\/span>\n<span style=\"color: #ABB2BF\">      <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">attempts<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&gt;=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">6<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u041b\u0438\u043c\u0438\u0442 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">      <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`${<\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">start<\/span><span style=\"color: #98C379\">} \u043c\u0441: \u043e\u0448\u0438\u0431\u043a\u0430 ${<\/span><span style=\"color: #E06C75\">err<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">message<\/span><span style=\"color: #98C379\">}, \u043f\u0430\u0443\u0437\u0430 ${<\/span><span style=\"color: #E06C75\">delay<\/span><span style=\"color: #98C379\">} \u043c\u0441`<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">      <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">poll<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">delay<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">      <\/span><span style=\"color: #E06C75\">delay<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Math<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">min<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">delay<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">*<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">2<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">MAX<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    });<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #E06C75\">poll<\/span><span style=\"color: #ABB2BF\">();<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u0430 (\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">1 \u043c\u0441: \u043e\u0448\u0438\u0431\u043a\u0430 503, \u043f\u0430\u0443\u0437\u0430 100 \u043c\u0441\n112 \u043c\u0441: \u043e\u0448\u0438\u0431\u043a\u0430 503, \u043f\u0430\u0443\u0437\u0430 200 \u043c\u0441\n313 \u043c\u0441: \u043e\u0448\u0438\u0431\u043a\u0430 503, \u043f\u0430\u0443\u0437\u0430 400 \u043c\u0441\n713 \u043c\u0441: \u043e\u0442\u0432\u0435\u0442 ok\n<\/code><\/pre>\n<p>\u041f\u043e\u0442\u043e\u043b\u043e\u043a \u043f\u0430\u0443\u0437\u044b \u0438 \u043b\u0438\u043c\u0438\u0442 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b: \u0431\u0435\u0437 \u043d\u0438\u0445 \u043f\u0440\u0438 \u0434\u043e\u043b\u0433\u043e\u043c \u0441\u0431\u043e\u0435 \u043a\u043b\u0438\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0436\u0434\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e.<\/p>\n<h2 id=\"s6\">\u041d\u0443\u043b\u0435\u0432\u0430\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/h2>\n<p><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout(fn, 0)<\/code> \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u041a\u043e\u043b\u0431\u044d\u043a \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u0447 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435 \u043c\u0438\u043a\u0440\u043e\u0437\u0430\u0434\u0430\u0447 (\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Promise<\/code>):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"1: \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(() =&gt; <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"4: setTimeout 0\"<\/span><span style=\"color: #ABB2BF\">), <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #E5C07B\">Promise<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">resolve<\/span><span style=\"color: #ABB2BF\">().<\/span><span style=\"color: #E06C75\">then<\/span><span style=\"color: #ABB2BF\">(() =&gt; <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"3: \u043c\u0438\u043a\u0440\u043e\u0437\u0430\u0434\u0430\u0447\u0430 Promise\"<\/span><span style=\"color: #ABB2BF\">));<\/span>\n<span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"2: \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434\"<\/span><span style=\"color: #ABB2BF\">);<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">1: \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434\n2: \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434\n3: \u043c\u0438\u043a\u0440\u043e\u0437\u0430\u0434\u0430\u0447\u0430 Promise\n4: setTimeout 0\n<\/code><\/pre>\n<p>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0435\u0449\u0435 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0430 \u0441\u043d\u0438\u0437\u0443: \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTML \u043f\u043e\u0441\u043b\u0435 \u043f\u044f\u0442\u0438 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 \u043e\u043d\u0430 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 4 \u043c\u0441, \u0430 \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u0432 \u0444\u043e\u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u0442\u0430\u0439\u043c\u0435\u0440\u044b \u043d\u0435 \u0447\u0430\u0449\u0435 \u0440\u0430\u0437\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. Chrome \u0434\u043b\u044f \u0432\u043a\u043b\u0430\u0434\u043a\u0438, \u0441\u043a\u0440\u044b\u0442\u043e\u0439 \u0434\u043e\u043b\u044c\u0448\u0435 5 \u043c\u0438\u043d\u0443\u0442 \u0438 \u0431\u0435\u0437 \u0437\u0432\u0443\u043a\u0430, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0438\u0437 5 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 \u0435\u0449\u0435 \u0441\u0438\u043b\u044c\u043d\u0435\u0435 &#8212; \u0434\u043e \u0440\u0430\u0437\u0430 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443.<\/p>\n<h2 id=\"s7\">\u041f\u0430\u0443\u0437\u0430 \u0447\u0435\u0440\u0435\u0437 await<\/h2>\n<p>\u0414\u043b\u044f \u00ab\u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c N \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u00bb \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0430\u0439\u043c\u0435\u0440 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442 \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Promise<\/code>. \u0412 Node.js \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">node:timers\/promises<\/code> (\u0444\u0430\u0439\u043b <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">.mjs<\/code>, ESM):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> { <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">as<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">sleep<\/span><span style=\"color: #ABB2BF\"> } <\/span><span style=\"color: #C678DD\">from<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\"node:timers\/promises\"<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">wait<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">ms<\/span><span style=\"color: #ABB2BF\">) =&gt; <\/span><span style=\"color: #56B6C2\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Promise<\/span><span style=\"color: #ABB2BF\">((<\/span><span style=\"color: #E06C75\">resolve<\/span><span style=\"color: #ABB2BF\">) =&gt; <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">resolve<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">ms<\/span><span style=\"color: #ABB2BF\">));<\/span>\n\n<span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0421\u0442\u0430\u0440\u0442\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #C678DD\">await<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">wait<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">500<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u041f\u0440\u043e\u0448\u043b\u043e ~0,5 \u0441 (Promise-\u043e\u0431\u0435\u0440\u0442\u043a\u0430)\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #C678DD\">await<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">sleep<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">500<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u041f\u0440\u043e\u0448\u043b\u043e \u0435\u0449\u0435 ~0,5 \u0441 (node:timers\/promises)\"<\/span><span style=\"color: #ABB2BF\">);<\/span><\/code><\/pre>\n<p>\u041e\u0431\u0435\u0440\u0442\u043a\u0430 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">wait<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0438\u043c\u043f\u043e\u0440\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">node:timers\/promises<\/code> &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Node.js.<\/p>\n<h2 id=\"s8\">\u041f\u0440\u0438\u043c\u0435\u0440: \u0442\u0430\u0439\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430<\/h2>\n<p>\u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043e\u0442\u0441\u0447\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u043d\u0430 1 \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u041e\u043d \u00ab\u0443\u043f\u043b\u044b\u0432\u0430\u0435\u0442\u00bb: \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0430 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u044b \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u044e\u0442\u0441\u044f. \u041d\u0430\u0434\u0435\u0436\u043d\u0435\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f (deadline) \u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0438\u043a\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">formatRemaining<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">ms<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">total<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Math<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">max<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E5C07B\">Math<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">ceil<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">ms<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">\/<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1000<\/span><span style=\"color: #ABB2BF\">));<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">m<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">String<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E5C07B\">Math<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">floor<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">total<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">\/<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">60<\/span><span style=\"color: #ABB2BF\">)).<\/span><span style=\"color: #E06C75\">padStart<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">2<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\"0\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">s<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">String<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">total<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">%<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">60<\/span><span style=\"color: #ABB2BF\">).<\/span><span style=\"color: #E06C75\">padStart<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">2<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\"0\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">`${<\/span><span style=\"color: #E06C75\">m<\/span><span style=\"color: #98C379\">}:${<\/span><span style=\"color: #E06C75\">s<\/span><span style=\"color: #98C379\">}`<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">startCountdown<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">seconds<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">onTick<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">onDone<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #56B6C2\">!<\/span><span style=\"color: #E5C07B\">Number<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E5C07B\">isFinite<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">seconds<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #56B6C2\">||<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">seconds<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">throw<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">RangeError<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">`seconds: \u043d\u0443\u0436\u043d\u043e \u0447\u0438\u0441\u043b\u043e &gt;= 0, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e ${<\/span><span style=\"color: #E06C75\">seconds<\/span><span style=\"color: #98C379\">}`<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  }<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">deadline<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">seconds<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">*<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1000<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">timerId<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">null<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">stopped<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">false<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">tick<\/span><span style=\"color: #ABB2BF\">() {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">left<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">deadline<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">Date<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">();<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">onTick<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">formatRemaining<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">left<\/span><span style=\"color: #ABB2BF\">));<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">stopped<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\">;                <\/span><span style=\"color: #7F848E\">\/\/ stop() \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 onTick<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">left<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&lt;=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">      <\/span><span style=\"color: #E06C75\">onDone<\/span><span style=\"color: #ABB2BF\">();<\/span>\n<span style=\"color: #ABB2BF\">      <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #7F848E\">\/\/ \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043a - \u043a \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0430 \u043d\u0435 \u0440\u043e\u0432\u043d\u043e \u0447\u0435\u0440\u0435\u0437 1000 \u043c\u0441<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">timerId<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">setTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">tick<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">left<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">%<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1000<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">||<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1000<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  }<\/span>\n\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">tick<\/span><span style=\"color: #ABB2BF\">();<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> () =&gt; { <\/span><span style=\"color: #E06C75\">stopped<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">true<\/span><span style=\"color: #ABB2BF\">; <\/span><span style=\"color: #E06C75\">clearTimeout<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">timerId<\/span><span style=\"color: #ABB2BF\">); };   <\/span><span style=\"color: #7F848E\">\/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">formatRemaining<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">), <\/span><span style=\"color: #E06C75\">formatRemaining<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">1<\/span><span style=\"color: #ABB2BF\">), <\/span><span style=\"color: #E06C75\">formatRemaining<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">61000<\/span><span style=\"color: #ABB2BF\">), <\/span><span style=\"color: #E06C75\">formatRemaining<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">599001<\/span><span style=\"color: #ABB2BF\">));<\/span>\n<span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">stop<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">startCountdown<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">3<\/span><span style=\"color: #ABB2BF\">, (<\/span><span style=\"color: #E06C75\">text<\/span><span style=\"color: #ABB2BF\">) =&gt; <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">text<\/span><span style=\"color: #ABB2BF\">), () =&gt; <\/span><span style=\"color: #E06C75\">console<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">log<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u0448\u043b\u043e\"<\/span><span style=\"color: #ABB2BF\">));<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 (\u0441\u0442\u0440\u043e\u043a\u0438 \u043e\u0442\u0441\u0447\u0435\u0442\u0430 &#8212; \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">00:00 00:01 01:01 10:00\n00:03\n00:02\n00:01\n00:00\n\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u0448\u043b\u043e\n<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u0445: 0 \u043c\u0441, 1 \u043c\u0441 (\u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0432\u0435\u0440\u0445 \u0434\u043e \u0441\u0435\u043a\u0443\u043d\u0434\u044b), 61 \u0441 \u0438 599,001 \u0441. <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">startCountdown<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">stop<\/code> &#8212; \u0432\u044b\u0437\u043e\u0432\u0438\u0442\u0435 \u0435\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0440\u0432\u0430\u0442\u044c \u043e\u0442\u0441\u0447\u0435\u0442.<\/p>\n<p>\u0414\u0432\u0435 \u0437\u0430\u0449\u0438\u0442\u044b \u0432 \u043a\u043e\u0434\u0435 \u043d\u0435 \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u043e\u0442\u044b. \u0411\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0445\u043e\u0434\u0430 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">startCountdown(NaN, ...)<\/code> \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">NaN:NaN<\/code> \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e: \u043e\u0441\u0442\u0430\u0442\u043e\u043a <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">NaN<\/code> \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">left &lt;= 0<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">NaN<\/code>, \u0441\u0442\u0440\u043e\u043a\u0430 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">\"10\"<\/code> \u0438 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u0440\u0430\u0437\u0443 \u0434\u0430\u044e\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">RangeError<\/code>. \u0424\u043b\u0430\u0433 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">stopped<\/code> \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">stop()<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">onTick<\/code>: \u0431\u0435\u0437 \u043d\u0435\u0433\u043e <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearTimeout<\/code> \u043e\u0442\u043c\u0435\u043d\u044f\u043b \u0431\u044b \u0443\u0436\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0438\u0439 \u0442\u0430\u0439\u043c\u0435\u0440, \u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043a \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0431\u044b \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043d\u0438\u0436\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0442\u0441\u0447\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0442\u0435 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435 (\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #ABB2BF\">&lt;<\/span><span style=\"color: #E06C75\">p<\/span> <span style=\"color: #E06C75\">id<\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #98C379\">\"clock\"<\/span><span style=\"color: #ABB2BF\">&gt;<\/span>00:10<span style=\"color: #ABB2BF\">&lt;\/<\/span><span style=\"color: #E06C75\">p<\/span><span style=\"color: #ABB2BF\">&gt;<\/span>\n<span style=\"color: #ABB2BF\">&lt;<\/span><span style=\"color: #E06C75\">button<\/span> <span style=\"color: #E06C75\">id<\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #98C379\">\"go\"<\/span><span style=\"color: #ABB2BF\">&gt;<\/span>\u0421\u0442\u0430\u0440\u0442<span style=\"color: #ABB2BF\">&lt;\/<\/span><span style=\"color: #E06C75\">button<\/span><span style=\"color: #ABB2BF\">&gt;<\/span>\n<span style=\"color: #ABB2BF\">&lt;<\/span><span style=\"color: #E06C75\">script<\/span><span style=\"color: #ABB2BF\">&gt;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #7F848E\">\/\/ \u0441\u044e\u0434\u0430 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c formatRemaining \u0438 startCountdown \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">clock<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">document<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getElementById<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"clock\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">stop<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">null<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E5C07B\">document<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getElementById<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"go\"<\/span><span style=\"color: #ABB2BF\">).<\/span><span style=\"color: #E06C75\">addEventListener<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"click\"<\/span><span style=\"color: #ABB2BF\">, () =&gt; {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">stop<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #E06C75\">stop<\/span><span style=\"color: #ABB2BF\">();                      <\/span><span style=\"color: #7F848E\">\/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u043a\u043b\u0438\u043a \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043e\u0442\u0441\u0447\u0435\u0442<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">stop<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">startCountdown<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">10<\/span><span style=\"color: #ABB2BF\">,<\/span>\n<span style=\"color: #ABB2BF\">      (<\/span><span style=\"color: #E06C75\">text<\/span><span style=\"color: #ABB2BF\">) =&gt; { <\/span><span style=\"color: #E06C75\">clock<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">textContent<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">text<\/span><span style=\"color: #ABB2BF\">; },<\/span>\n<span style=\"color: #ABB2BF\">      () =&gt; { <\/span><span style=\"color: #E06C75\">clock<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">textContent<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\"\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u0448\u043b\u043e\"<\/span><span style=\"color: #ABB2BF\">; });<\/span>\n<span style=\"color: #ABB2BF\">  });<\/span>\n<span style=\"color: #ABB2BF\">&lt;\/<\/span><span style=\"color: #E06C75\">script<\/span><span style=\"color: #ABB2BF\">&gt;<\/span><\/code><\/pre>\n<p><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">textContent<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">innerHTML<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0430.<\/p>\n<h2 id=\"s9\">requestAnimationFrame: \u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/h2>\n<p><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">requestAnimationFrame(callback)<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439 \u043a\u0430\u0434\u0440\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 (\u0447\u0430\u0441\u0442\u043e 60 \u0413\u0446, \u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 120 \u0413\u0446 \u0438 \u0432\u044b\u0448\u0435), \u0430 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442 \u043e\u0442 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u043d\u0435 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u043a\u0430\u0434\u0440\u043e\u0432 (\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">box<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">document<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getElementById<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"box\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">startTime<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">null<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #C678DD\">let<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">frameId<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">null<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">function<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">rotate<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">startTime<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">===<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">null<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #E06C75\">startTime<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #C678DD\">const<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">angle<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> ((<\/span><span style=\"color: #E06C75\">now<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">startTime<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #56B6C2\">\/<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1000<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #56B6C2\">*<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">90<\/span><span style=\"color: #ABB2BF\">;   <\/span><span style=\"color: #7F848E\">\/\/ 90 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">box<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">style<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">transform<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">`rotate(${<\/span><span style=\"color: #E06C75\">angle<\/span><span style=\"color: #98C379\">}deg)`<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">frameId<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">requestAnimationFrame<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">rotate<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #E06C75\">frameId<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">requestAnimationFrame<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">rotate<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #7F848E\">\/\/ \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430: cancelAnimationFrame(frameId);<\/span><\/code><\/pre>\n<h2 id=\"s10\">\u041a\u0430\u043a\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u0417\u0430\u0434\u0430\u0447\u0430<\/th>\n<th>\u0427\u0442\u043e \u0432\u0437\u044f\u0442\u044c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0447\u0435\u0440\u0435\u0437 \u0432\u0440\u0435\u043c\u044f<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u041b\u0435\u0433\u043a\u0430\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 (\u0447\u0430\u0441\u044b, \u043e\u043f\u0440\u043e\u0441 \u0440\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443)<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u041f\u043e\u0432\u0442\u043e\u0440 \u0441 \u0434\u043e\u043b\u0433\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u0443\u0437\u043e\u0439<\/td>\n<td>\u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">requestAnimationFrame<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u041f\u0430\u0443\u0437\u0430 \u0432 async-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">await<\/code> + Promise-\u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u0422\u043e\u0447\u043d\u044b\u0439 \u043e\u0442\u0441\u0447\u0435\u0442 \u0434\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/td>\n<td>deadline + <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Date.now()<\/code> \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0438\u043a\u0435<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"s11\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<ul>\n<li>\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u0441 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c; \u0432 JavaScript \u044d\u0442\u043e <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code>, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code> \u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">requestAnimationFrame<\/code>, \u0438\u0445 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0440\u0435\u0434\u0430 (\u0431\u0440\u0430\u0443\u0437\u0435\u0440, Node.js).<\/li>\n<li>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 &#8212; \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f, \u0430 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f: \u043a\u043e\u043b\u0431\u044d\u043a \u0436\u0434\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043c\u0438\u043a\u0440\u043e\u0437\u0430\u0434\u0430\u0447.<\/li>\n<li>\u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c: \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0439\u0442\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0439\u0442\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearTimeout<\/code>\/<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearInterval<\/code>\/<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">cancelAnimationFrame<\/code>.<\/li>\n<li>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code> \u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0430\u0443\u0437\u0443 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code> \u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0435\u0440\u0438\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0440\u0442\u0430\u043c\u0438.<\/li>\n<li>\u041e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043e\u0442\u0441\u0447\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f, \u0430 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430, \u0438\u043d\u0430\u0447\u0435 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0441\u0442\u0430\u0432\u0430\u0442\u044c.<\/li>\n<\/ul>\n<h2 id=\"s12\">\u0413\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \/ \u0441\u0432\u044f\u0437\u044c \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/h2>\n<div class=\"oj-cta\" style=\"background:#fbf4e4;border-left:4px solid #c9962b;border-radius:8px;padding:16px 20px;margin:24px 0\">\n<p style=\"margin:0 0 8px\"><strong>\u041e\u0441\u0432\u043e\u0439\u0442\u0435 \u0442\u0435\u043c\u0443 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/strong><\/p>\n<p>\u0422\u0430\u0439\u043c\u0435\u0440\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435: \u0430\u0432\u0442\u043e\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430, \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0435\u0440\u0435\u0434 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435, \u043f\u043e\u0432\u0442\u043e\u0440 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u044b, \u043e\u0442\u0441\u0447\u0435\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0430\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u0430. \u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u0446\u0438\u043a\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0446\u0435\u043b\u0438\u043a\u043e\u043c &#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044e\u0442 \u043d\u0430 \u043a\u0443\u0440\u0441\u0435 <a href=\"https:\/\/otus.ru\/lessons\/javascript-basic\/?int_article=tajmer-osobennosti-razrabotki-i-primer-koda&amp;int_place=article&amp;int_variant=v1\">\u00abJavaScript-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c\u00bb<\/a>. \u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043d\u0430 <a href=\"https:\/\/otus.ru\/events\/?int_article=tajmer-osobennosti-razrabotki-i-primer-koda&amp;int_place=article&amp;int_variant=v1\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0443\u0440\u043e\u043a\u0430\u0445 Otus<\/a>.<\/p>\n<\/div>\n<h2 id=\"s13\">FAQ<\/h2>\n<p><strong>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u0435\u0433\u043e \u0436\u0435 \u043a\u043e\u043b\u0431\u044d\u043a\u0430?<\/strong><br \/>\n\u0414\u0430. \u0414\u043b\u044f <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code> \u0442\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u044e\u0442 &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearInterval(id)<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435. \u0414\u043b\u044f <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code> \u043e\u0442\u043c\u0435\u043d\u0430 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430: \u043e\u043d \u0443\u0436\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b; \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u0439\u043c\u0435\u0440 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u00ab\u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u00bb?<\/strong><br \/>\n\u0411\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b: \u0432 \u0441\u043a\u0440\u044b\u0442\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0436\u0435, \u0430 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">requestAnimationFrame<\/code> \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u044f \u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442\u0441\u0447\u0435\u0442\u0430 \u0431\u0435\u0440\u0443\u0442 \u0438\u0437 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Date.now()<\/code> \u0438\u043b\u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">performance.now()<\/code>, \u0430 \u043d\u0435 \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0438\u0445 \u0442\u0438\u043a\u043e\u0432.<\/p>\n<p><strong>\u0427\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f clearTimeout \u043e\u0442 clearInterval?<\/strong><br \/>\n\u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043e\u0431\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043e\u0431\u0449\u0438\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432, \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c\u044b, \u043d\u043e \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0430\u0440\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearTimeout<\/code> \u0434\u043b\u044f <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setTimeout<\/code>, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">clearInterval<\/code> \u0434\u043b\u044f <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setInterval<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 &#8212; \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0441\u0440\u0430\u0437\u0443, \u0430 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u043e\u0434\u0438\u043d \u0440\u0430\u0437) \u0438\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c. \u0412 JavaScript \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430: setTimeout (\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a), setInterval (\u043f\u043e\u0432\u0442\u043e\u0440) \u0438 requestAnimationFrame (\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439 \u043a\u0430\u0434\u0440\u0430 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435). \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u043d\u0438\u0445 &#8212; \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f, \u0430 \u043d\u0435 \u0442\u043e\u0447\u043d\u0430\u044f: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":9472,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[83,65],"class_list":["post-9471","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-polza","tag-javascript","tag-programmirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0430\u0439\u043c\u0435\u0440 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0432 JavaScript: setTimeout, setInterval, clearTimeout, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440, requestAnimationFrame \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043e\u0442\u0441\u0447\u0435\u0442.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"A. Pavlenko\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#article\",\"name\":\"\\u0422\\u0430\\u0439\\u043c\\u0435\\u0440 \\u0432 JavaScript: setTimeout, setInterval, \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 | Otus\",\"headline\":\"\\u0422\\u0430\\u0439\\u043c\\u0435\\u0440 \\u0432 JavaScript: \\u043a\\u0430\\u043a \\u0440\\u0430\\u0431\\u043e\\u0442\\u0430\\u0435\\u0442 \\u0438 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 \\u043a\\u043e\\u0434\\u0430 \\u043e\\u0431\\u0440\\u0430\\u0442\\u043d\\u043e\\u0433\\u043e \\u043e\\u0442\\u0441\\u0447\\u0435\\u0442\\u0430\",\"author\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/oj-1080x720-51.jpg\",\"width\":2245,\"height\":1587},\"datePublished\":\"2026-09-24T09:00:00+00:00\",\"dateModified\":\"2026-09-25T15:25:17+00:00\",\"inLanguage\":\"ru-RU\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#webpage\"},\"articleSection\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435, JavaScript, \\u043f\\u0440\\u043e\\u0433\\u0440\\u0430\\u043c\\u043c\\u0438\\u0440\\u043e\\u0432\\u0430\\u043d\\u0438\\u0435\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/otus.ru\\\/journal\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/#listItem\",\"name\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/#listItem\",\"position\":2,\"name\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435\",\"item\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#listItem\",\"name\":\"\\u0422\\u0430\\u0439\\u043c\\u0435\\u0440 \\u0432 JavaScript: \\u043a\\u0430\\u043a \\u0440\\u0430\\u0431\\u043e\\u0442\\u0430\\u0435\\u0442 \\u0438 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 \\u043a\\u043e\\u0434\\u0430 \\u043e\\u0431\\u0440\\u0430\\u0442\\u043d\\u043e\\u0433\\u043e \\u043e\\u0442\\u0441\\u0447\\u0435\\u0442\\u0430\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#listItem\",\"position\":3,\"name\":\"\\u0422\\u0430\\u0439\\u043c\\u0435\\u0440 \\u0432 JavaScript: \\u043a\\u0430\\u043a \\u0440\\u0430\\u0431\\u043e\\u0442\\u0430\\u0435\\u0442 \\u0438 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 \\u043a\\u043e\\u0434\\u0430 \\u043e\\u0431\\u0440\\u0430\\u0442\\u043d\\u043e\\u0433\\u043e \\u043e\\u0442\\u0441\\u0447\\u0435\\u0442\\u0430\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/#listItem\",\"name\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#organization\",\"name\":\"\\u041e\\u0442\\u0443\\u0441 \\u043e\\u043d\\u043b\\u0430\\u0439\\u043d-\\u043e\\u0431\\u0440\\u0430\\u0437\\u043e\\u0432\\u0430\\u043d\\u0438\\u0435\",\"description\":\"\\u0411\\u043b\\u043e\\u0433 \\u043f\\u0440\\u043e IT\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/\",\"telephone\":\"+74999389202\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/OTUS-journal-logo-180x180-1.png\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#organizationLogo\",\"width\":180,\"height\":180},\"image\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCetgtvy93o3i3CvyGXKFU3g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/\",\"name\":\"A. Pavlenko\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/13488c7d5b657aaaf1808afd398f71e0225df07dd94eb7e5fcdfc45feff43cb5?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"A. Pavlenko\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#webpage\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/\",\"name\":\"\\u0422\\u0430\\u0439\\u043c\\u0435\\u0440 \\u0432 JavaScript: setTimeout, setInterval, \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 | Otus\",\"description\":\"\\u0427\\u0442\\u043e \\u0442\\u0430\\u043a\\u043e\\u0435 \\u0442\\u0430\\u0439\\u043c\\u0435\\u0440 \\u0432 \\u043f\\u0440\\u0438\\u043b\\u043e\\u0436\\u0435\\u043d\\u0438\\u0438 \\u0438 \\u043a\\u0430\\u043a \\u043e\\u043d \\u0443\\u0441\\u0442\\u0440\\u043e\\u0435\\u043d \\u0432 JavaScript: setTimeout, setInterval, clearTimeout, \\u0432\\u043b\\u043e\\u0436\\u0435\\u043d\\u043d\\u044b\\u0439 \\u0442\\u0430\\u0439\\u043c\\u0435\\u0440, requestAnimationFrame \\u0438 \\u043e\\u0431\\u0440\\u0430\\u0442\\u043d\\u044b\\u0439 \\u043e\\u0442\\u0441\\u0447\\u0435\\u0442.\",\"inLanguage\":\"ru-RU\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/oj-1080x720-51.jpg\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#mainImage\",\"width\":2245,\"height\":1587},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/tajmer-osobennosti-razrabotki-i-primer-koda\\\/#mainImage\"},\"datePublished\":\"2026-09-24T09:00:00+00:00\",\"dateModified\":\"2026-09-25T15:25:17+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#website\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/\",\"name\":\"OTUS \\u0416\\u0443\\u0440\\u043d\\u0430\\u043b - \\u0411\\u043b\\u043e\\u0433 \\u043f\\u0440\\u043e IT\",\"alternateName\":\"OTUS \\u0416\\u0443\\u0440\\u043d\\u0430\\u043b\",\"description\":\"\\u0411\\u043b\\u043e\\u0433 \\u043f\\u0440\\u043e IT\",\"inLanguage\":\"ru-RU\",\"publisher\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: setTimeout, setInterval, \u043f\u0440\u0438\u043c\u0435\u0440 | Otus","description":"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0430\u0439\u043c\u0435\u0440 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0432 JavaScript: setTimeout, setInterval, clearTimeout, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440, requestAnimationFrame \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043e\u0442\u0441\u0447\u0435\u0442.","canonical_url":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#article","name":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: setTimeout, setInterval, \u043f\u0440\u0438\u043c\u0435\u0440 | Otus","headline":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430","author":{"@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author"},"publisher":{"@id":"https:\/\/otus.ru\/journal\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2024\/03\/oj-1080x720-51.jpg","width":2245,"height":1587},"datePublished":"2026-09-24T09:00:00+00:00","dateModified":"2026-09-25T15:25:17+00:00","inLanguage":"ru-RU","mainEntityOfPage":{"@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#webpage"},"isPartOf":{"@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#webpage"},"articleSection":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435, JavaScript, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435"},{"@type":"BreadcrumbList","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/#listItem","position":1,"name":"Home","item":"https:\/\/otus.ru\/journal\/","nextItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/category\/polza\/#listItem","name":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435"}},{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/category\/polza\/#listItem","position":2,"name":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435","item":"https:\/\/otus.ru\/journal\/category\/polza\/","nextItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#listItem","name":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430"},"previousItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#listItem","position":3,"name":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430","previousItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/category\/polza\/#listItem","name":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435"}}]},{"@type":"Organization","@id":"https:\/\/otus.ru\/journal\/#organization","name":"\u041e\u0442\u0443\u0441 \u043e\u043d\u043b\u0430\u0439\u043d-\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435","description":"\u0411\u043b\u043e\u0433 \u043f\u0440\u043e IT","url":"https:\/\/otus.ru\/journal\/","telephone":"+74999389202","logo":{"@type":"ImageObject","url":"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2026\/04\/OTUS-journal-logo-180x180-1.png","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#organizationLogo","width":180,"height":180},"image":{"@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#organizationLogo"},"sameAs":["https:\/\/www.youtube.com\/channel\/UCetgtvy93o3i3CvyGXKFU3g"]},{"@type":"Person","@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author","url":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/","name":"A. Pavlenko","image":{"@type":"ImageObject","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/13488c7d5b657aaaf1808afd398f71e0225df07dd94eb7e5fcdfc45feff43cb5?s=96&d=mm&r=g","width":96,"height":96,"caption":"A. Pavlenko"}},{"@type":"WebPage","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#webpage","url":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/","name":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: setTimeout, setInterval, \u043f\u0440\u0438\u043c\u0435\u0440 | Otus","description":"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0430\u0439\u043c\u0435\u0440 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0432 JavaScript: setTimeout, setInterval, clearTimeout, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440, requestAnimationFrame \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043e\u0442\u0441\u0447\u0435\u0442.","inLanguage":"ru-RU","isPartOf":{"@id":"https:\/\/otus.ru\/journal\/#website"},"breadcrumb":{"@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#breadcrumblist"},"author":{"@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author"},"creator":{"@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2024\/03\/oj-1080x720-51.jpg","@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#mainImage","width":2245,"height":1587},"primaryImageOfPage":{"@id":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/#mainImage"},"datePublished":"2026-09-24T09:00:00+00:00","dateModified":"2026-09-25T15:25:17+00:00"},{"@type":"WebSite","@id":"https:\/\/otus.ru\/journal\/#website","url":"https:\/\/otus.ru\/journal\/","name":"OTUS \u0416\u0443\u0440\u043d\u0430\u043b - \u0411\u043b\u043e\u0433 \u043f\u0440\u043e IT","alternateName":"OTUS \u0416\u0443\u0440\u043d\u0430\u043b","description":"\u0411\u043b\u043e\u0433 \u043f\u0440\u043e IT","inLanguage":"ru-RU","publisher":{"@id":"https:\/\/otus.ru\/journal\/#organization"}}]}},"aioseo_meta_data":{"post_id":"9471","title":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: setTimeout, setInterval, \u043f\u0440\u0438\u043c\u0435\u0440 | Otus","description":"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0430\u0439\u043c\u0435\u0440 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0432 JavaScript: setTimeout, setInterval, clearTimeout, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440, requestAnimationFrame \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043e\u0442\u0441\u0447\u0435\u0442.","keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-03-14 19:56:45","updated":"2026-09-25 18:08:36","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/otus.ru\/journal\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/otus.ru\/journal\/category\/polza\/\" title=\"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435\">\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/otus.ru\/journal\/"},{"label":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435","link":"https:\/\/otus.ru\/journal\/category\/polza\/"},{"label":"\u0422\u0430\u0439\u043c\u0435\u0440 \u0432 JavaScript: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430","link":"https:\/\/otus.ru\/journal\/tajmer-osobennosti-razrabotki-i-primer-koda\/"}],"_links":{"self":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/9471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/comments?post=9471"}],"version-history":[{"count":4,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/9471\/revisions"}],"predecessor-version":[{"id":12859,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/9471\/revisions\/12859"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/media\/9472"}],"wp:attachment":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/media?parent=9471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/categories?post=9471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/tags?post=9471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}