{"id":454910,"date":"2025-04-06T03:00:33","date_gmt":"2025-04-06T03:00:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=454910"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=454910","title":{"rendered":"<span>IF Statement \u0432 JS<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041e\u0431 IF-Statement (\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435)<\/h2>\n<p><strong>IF-Statement <\/strong>&#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e \u0438\u0441\u0442\u0438\u043d\u043d\u043e \u0438\u043b\u0438 \u043b\u043e\u0436\u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 ECMAScript, syntax if-statement \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">if (\u0443\u0441\u043b\u043e\u0432\u0438\u0435) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 if (\u0443\u0441\u043b\u043e\u0432\u0438\u0435) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u04351 else \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u04352<\/code><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a \u0441 ELSE \u0442\u0430\u043a \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u0435\u0437 ELSE.<\/p>\n<ul>\n<li>\n<p><strong>IF<\/strong> \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a <strong>&#171;\u0435\u0441\u043b\u0438&#187;<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>ELSE<\/strong> \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a <strong>&#171;\u0438\u043d\u0430\u0447\u0435&#187;<\/strong> \u0438\u043b\u0438 \u0435\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 <strong>&#171;\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c  \u0441\u043b\u0443\u0447\u0430\u0435&#187;<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 (dangling else)<\/strong><\/p>\n<blockquote>\n<p>\u041f\u043e\u043d\u044f\u0442\u0438\u0435 Dangling ELSE (\u0438\u043b\u0438 \u043a\u0430\u043a \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0432\u0438\u0441\u044f\u0449\u0438\u0439 else) \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 <strong>if-else<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0438 \u043d\u0435\u044f\u0441\u043d\u043e, \u043a \u043a\u0430\u043a\u043e\u043c\u0443 if \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0431\u043b\u043e\u043a else. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u043d\u0438\u0446 \u0431\u043b\u043e\u043a\u043e\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a {..} ) \u0438\u043b\u0438 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0438\u0445 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 dangling else:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 5; if (x &gt; 1)     if (x % 2 !== 0)         if (x !== undefined)              console.log(`x is ${x}`); else      console.log('x is not greater than 1');  if (x &amp; 1)      if (x === undefined)         console.log(`(1) x is ${x}`); else     console.log('----');<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430 if-else. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u0447\u0442\u043e \u0432\u044b\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434? \u0412\u0435\u0440\u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fa9\/a93\/102\/fa9a931020831f882aeb528e1f894cf1.png\" alt=\"\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\" title=\"\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\" width=\"108\" height=\"49\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fa9\/a93\/102\/fa9a931020831f882aeb528e1f894cf1.png\"\/><\/p>\n<div><figcaption>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u0438\u043d\u0438-\u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435, \u0442\u043e else \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 if.  \u0422\u043e \u0435\u0441\u0442\u044c:<\/p>\n<ol>\n<li>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u0435 else \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a if (x !== undefined), \u0430 \u043d\u0435 \u043a if (x &gt; 1), \u043a\u0430\u043a \u043c\u043e\u0433\u043b\u043e \u0431\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0431\u043b\u043e\u043a\u0435 else \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u0443\u0436\u0435 \u043a if (x === undefined), \u0430 \u043d\u0435 \u043a if (x &amp; 1).<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u044b \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0437\u0430\u0434\u0430\u0434\u0438\u0442\u0435 \u0432\u043e\u043f\u0440\u043e\u0441 \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 dangling else? \u041a\u0430\u043a \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0435\u0431\u044f \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u044c \u043e\u0442 \u044d\u0442\u043e\u0439 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b? \u0412\u0441\u0435 \u043f\u0440\u043e\u0449\u0435 \u0447\u0435\u043c \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 <code>{}<\/code> &#8212; \u0442\u0430\u043a \u0432\u044b \u0431\u043e\u043b\u0435\u0435 \u044f\u0432\u043d\u043e\/\u0447\u0435\u0442\u043a\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>\u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439, \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 (\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439) \u043a\u043e\u0434:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 5; if (x &gt; 1) {     if (x % 2 !== 0) {         if (x !== undefined) {             console.log(`x is ${x}`);         } else {             console.log(`x is undefined`);         }        } else {         console.log('x is even');     } } else {     console.log('----'); }      if (x &amp; 1) {     if (x === undefined) {         console.log(`(1) x is ${x}`);     } else {         console.log('x is not undefined');      } } else {     console.log('----');  }     <\/code><\/pre>\n<h2>IF-Statement \u0432 JS \u0440\u0430\u0431\u043e\u0442\u0430 \u0438\u0437\u043d\u0443\u0442\u0440\u0438<\/h2>\n<p>\u041e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043f\u0440\u044f\u043c\u043e \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e ECMAScript, \u043f\u0443\u0441\u0442\u044c \u0435\u0441\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">if (exp) Statement else Statement<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0436\u0435 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438:<\/p>\n<ul>\n<li>\n<p>\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 exp \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/p>\n<p><code>expRef = Evaluation(exp)<\/code><\/p>\n<p>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 expRef \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0432 \u0431\u0443\u043b\u0435\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<br \/>expVal = ToBoolean(GetValue(expRef))<\/p>\n<p>\u0447\u0435\u0440\u0435\u0437 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e ToBoolean. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 expRef.<\/p>\n<p><u>\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 ToBoolean \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/u><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5be\/177\/54b\/5be17754b2c4529aaac4d226ecbfe055.png\" alt=\"\u0440\u0430\u0431\u043e\u0442\u0430 ToBoolean \u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\" title=\"\u0440\u0430\u0431\u043e\u0442\u0430 ToBoolean \u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\" width=\"795\" height=\"130\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5be\/177\/54b\/5be17754b2c4529aaac4d226ecbfe055.png\"\/><\/p>\n<div><figcaption>\u0440\u0430\u0431\u043e\u0442\u0430 ToBoolean \u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Boolean, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 Falsy Values (undefined, null, +-0, 0, NaN \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430), \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f false.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f true.<\/p>\n<\/li>\n<\/ul>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 expVal \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043b\u0438\u0431\u043e true, \u043b\u0438\u0431\u043e false.<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0442\u0435\u043c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u043e (\u0442\u043e \u0435\u0441\u0442\u044c true), \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043f\u0435\u0440\u0432\u044b\u0439 Statement (\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u043b\u043e\u043a \u043f\u043e\u0441\u043b\u0435 if).<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043b\u043e\u0436\u043d\u043e (\u0442\u043e \u0435\u0441\u0442\u044c false) \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0443\u0436\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 Statement (\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u043b\u043e\u043a else).<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u0447\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a stmtCompletion<\/p>\n<p><code>stmtCompletion = Completion(Evaluation(Statement))<\/code><\/p>\n<ul>\n<li>\n<p>stmt &#8212; \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 &#171;Statement&#187; (\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435). \u0418 \u0432\u043e \u0432\u0441\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 ECMAScript &#8212; \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 Statement &#8212; \u044d\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0410 \u0432\u043e\u0442 stmtCompletion \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 Completion Record, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e Statement.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eb7\/b10\/ef0\/eb7b10ef0587dd3b81c028a655a60d35.png\" alt=\"\u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 &quot;Completion Record&quot;\" title=\"\u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 &quot;Completion Record&quot;\" width=\"1254\" height=\"380\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eb7\/b10\/ef0\/eb7b10ef0587dd3b81c028a655a60d35.png\"\/><\/p>\n<div><figcaption>\u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 &#171;Completion Record&#187;<\/figcaption><\/div>\n<\/figure>\n<p><u>Completion Record \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437:<\/u><\/p>\n<ul>\n<li>\n<p>[[Type]] &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 normal, break, ..).<\/p>\n<\/li>\n<li>\n<p>[[Value]]- \u0432\u043e\u0437\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (empty, \u0435\u0441\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f).<\/p>\n<\/li>\n<li>\n<p>[[Target]] &#8212; \u043c\u0435\u0442\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0438\u0434\u0435\u0442 \u0432\u043e<\/p>\n<p>Return ? UpdateEmpty(stmtCompletion, undefined)<\/p>\n<p>\u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0435\u0439, \u0447\u0442\u043e \u0442\u0430\u043c \u043d\u0435 empty (\u0435\u0441\u043b\u0438 \u043f\u0443\u0441\u0442\u043e, \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f undefined)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435-2.<\/strong><\/p>\n<blockquote>\n<p>\u0418 \u0432\u043e\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u0435\u0441\u043b\u0438 \u0431\u043b\u043e\u043a ELSE \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c, \u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043b\u043e\u0436\u043d\u043e, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0435\u0440\u043d\u0435\u0442 <strong>undefined<\/strong>.<\/p>\n<\/blockquote>\n<h2>\u0410 \u043a\u0430\u043a \u0436\u0435 \u043d\u0430\u0448\u0435 ELSE IF??<\/h2>\n<p><strong>ELSE IF (\u043a\u0430\u043a \u0435\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 &#171;\u0438\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438&#187;)<\/strong> &#8212; \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. ELSE IF &#8212; \u044d\u0442\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e ELSE \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e IF, \u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u044d\u0442\u0430 \u0432\u0441\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e ELSE IF &#8212; \u044d\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 else \u0441 \u043d\u043e\u0432\u044b\u043c if \u0432\u043d\u0443\u0442\u0440\u0438, \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043e\u043f. \u0443\u0441\u043b\u043e\u0432\u0438\u0439.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 6;  if (x &gt; 0) {     ++x;     console.log(x); } else if (x &lt; 0) {     --x;     console.log(x); } else {     x *= 47127     console.log(x); }<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435-3.<\/strong><\/p>\n<blockquote>\n<p>\u0415\u0449\u0435 \u043a\u0441\u0442\u0430\u0442\u0438 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b.<\/p>\n<\/blockquote>\n<h2>\u0422\u0435\u0440\u043c\u0438\u043d &#171;\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438&#187;<\/h2>\n<p>\u0411\u0435\u0437 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 if \u0443\u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0442\u0435\u043b\u043e\u043c, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438  \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p><strong>\u0418 \u0432\u043e\u0442 \u0432\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 23714;  if (x &gt; 0)     x += 34815;     x *= -1;  console.log(x); \/\/ -58529<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435\u043c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0434\u0435\u0442 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435\u043c. \u0422\u0430\u043a \u0432\u043e\u0442 *= -1 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u0434\u0430! \u0410 += 34815 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f.<\/p>\n<p>\u0418 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 (\u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0447\u0442\u043e\u0431\u044b *= \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f) \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 &#8212; \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044f \u043b\u043e\u0433\u0438\u043a\u0443 &#8212; \u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0443\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0430\u0432\u0434\u0430:<\/p>\n<pre><code class=\"javascript\">let x = 23714;  if (x &lt; 0) {     x += 34815;     x *= -1; }      console.log(x); \/\/ 23714<\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0431\u0435\u0437 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a<\/h2>\n<ul>\n<li>\n<p>dangling else<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0434\u0440\u0443\u0433\u0438\u0435..<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435 (\u0438 \u0441\u043e\u0432\u0435\u0442):<\/strong><\/p>\n<blockquote>\n<p>\u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 {..} !!!<\/p>\n<\/blockquote>\n<h2>\u041d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/h2>\n<p>\u0420\u0430\u0437 \u0443\u0436 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0438\u0445 \u0432\u044b\u0448\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438 \u0442\u0443\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f. \u041a\u0430\u043a \u0432\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0443\u0434\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0439\u0434\u0435\u0442 \u0432 if, \u0438\u043b\u0438 \u0436\u0435 \u0432 else? \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 &#8212; \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code class=\"javascript\">if (1 &amp;&amp; \"abcd\" &amp;&amp; 12) {     console.log(1); } else {     console.log(2); }<\/code><\/pre>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 (<em>\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0434\u0443\u043c\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 70-90% js-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043c\u0435\u043d\u044f \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043d\u0435\u0442<\/em>), \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 if, \u0438 \u0442\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 1 &#8212; \u044d\u0442\u043e true, &#171;abcd&#187; &#8212; true, 12 &#8212; \u044d\u0442\u043e \u0442\u043e\u0436\u0435 true -&gt; \u0437\u043d\u0430\u0447\u0438\u0442 true &amp;&amp; true &amp;&amp; true -&gt; \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u0430\u0435\u0442 \u043d\u0430\u043c true. \u041e\u0439 \u043a\u0430\u043a \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u0443 \u043d\u0430\u0441 \u0418\u0421\u0422\u0418\u041d\u0410, \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 if, \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0446\u0438\u0444\u0440\u0443 1.<\/p>\n<p><strong>\u041d\u041e<\/strong><\/p>\n<p>\u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0442\u0430\u043a! \u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 IF-Statement.. \u0434\u0430-\u0434\u0430 \u0442\u043e \u0447\u0442\u043e \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432\u044b\u0448\u0435 \u043f\u0440\u043e Evaluation, \u043f\u0440\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 ToBoolean \u0438 \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<ul>\n<li>\n<p>\u0431\u0435\u0440\u0435\u0442\u0441\u044f exp<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f expRef<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f expVal \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442 ToBoolean(GetValue(expRef))<\/p>\n<\/li>\n<\/ul>\n<p><u>\u0418\u0442\u0430\u043a, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/u><\/p>\n<ul>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u0430\u043a\u043e\u0435 \u0443 \u043d\u0430\u0441 exp<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441\u043b\u0435\u0432\u0430 1 &amp;&amp; &#171;abcd&#187; <\/p>\n<ul>\n<li>\n<p>\u043f\u043e ToBoolean(1) &#8212;&gt; true<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e ToBoolean(&#171;abcd&#187;) &#8212;&gt; true<\/p>\n<p>\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0443 \u043d\u0430\u0441 true &amp;&amp; true &#8212; \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0435\u0441\u043b\u0438 \u0441\u043b\u0435\u0432\u0430 \u0441\u0442\u043e\u0438\u0442 true, \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c. \u0418 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u044b \u043d\u0435 true, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#171;abcd&#187;.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0443\u0436\u0435 &#171;abcd&#187; &amp;&amp; 12<\/p>\n<ul>\n<li>\n<p>ToBoolean(&#171;abcd&#187;) &#8212;&gt; true<\/p>\n<\/li>\n<li>\n<p>ToBoolean(12) &#8212;&gt; true<\/p>\n<p>\u0441\u043b\u0435\u0432\u0430 \u0441\u043d\u043e\u0432\u0430 \u0441\u0442\u043e\u0438\u0442 true \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 12.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u0448 exp=12<\/p>\n<\/li>\n<li>\n<p>ToBoolean(12) &#8212;&gt; true &#8212; \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 if.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/897884\/\"> https:\/\/habr.com\/ru\/articles\/897884\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041e\u0431 IF-Statement (\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435)<\/h2>\n<p><strong>IF-Statement <\/strong>&#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e \u0438\u0441\u0442\u0438\u043d\u043d\u043e \u0438\u043b\u0438 \u043b\u043e\u0436\u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 ECMAScript, syntax if-statement \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">if (\u0443\u0441\u043b\u043e\u0432\u0438\u0435) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 if (\u0443\u0441\u043b\u043e\u0432\u0438\u0435) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u04351 else \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u04352<\/code><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a \u0441 ELSE \u0442\u0430\u043a \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u0435\u0437 ELSE.<\/p>\n<ul>\n<li>\n<p><strong>IF<\/strong> \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a <strong>&#171;\u0435\u0441\u043b\u0438&#187;<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>ELSE<\/strong> \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a <strong>&#171;\u0438\u043d\u0430\u0447\u0435&#187;<\/strong> \u0438\u043b\u0438 \u0435\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 <strong>&#171;\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c  \u0441\u043b\u0443\u0447\u0430\u0435&#187;<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 (dangling else)<\/strong><\/p>\n<blockquote>\n<p>\u041f\u043e\u043d\u044f\u0442\u0438\u0435 Dangling ELSE (\u0438\u043b\u0438 \u043a\u0430\u043a \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0432\u0438\u0441\u044f\u0449\u0438\u0439 else) \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 <strong>if-else<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0438 \u043d\u0435\u044f\u0441\u043d\u043e, \u043a \u043a\u0430\u043a\u043e\u043c\u0443 if \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0431\u043b\u043e\u043a else. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u043d\u0438\u0446 \u0431\u043b\u043e\u043a\u043e\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a {..} ) \u0438\u043b\u0438 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0438\u0445 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 dangling else:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 5; if (x &gt; 1)     if (x % 2 !== 0)         if (x !== undefined)              console.log(`x is ${x}`); else      console.log('x is not greater than 1');  if (x &amp; 1)      if (x === undefined)         console.log(`(1) x is ${x}`); else     console.log('----');<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430 if-else. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u0447\u0442\u043e \u0432\u044b\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434? \u0412\u0435\u0440\u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n<figure class=\"\">\n<div><figcaption>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u0438\u043d\u0438-\u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435, \u0442\u043e else \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 if.  \u0422\u043e \u0435\u0441\u0442\u044c:<\/p>\n<ol>\n<li>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u0435 else \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a if (x !== undefined), \u0430 \u043d\u0435 \u043a if (x &gt; 1), \u043a\u0430\u043a \u043c\u043e\u0433\u043b\u043e \u0431\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0431\u043b\u043e\u043a\u0435 else \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u0443\u0436\u0435 \u043a if (x === undefined), \u0430 \u043d\u0435 \u043a if (x &amp; 1).<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u044b \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0437\u0430\u0434\u0430\u0434\u0438\u0442\u0435 \u0432\u043e\u043f\u0440\u043e\u0441 \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 dangling else? \u041a\u0430\u043a \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0435\u0431\u044f \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u044c \u043e\u0442 \u044d\u0442\u043e\u0439 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b? \u0412\u0441\u0435 \u043f\u0440\u043e\u0449\u0435 \u0447\u0435\u043c \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 <code>{}<\/code> &#8212; \u0442\u0430\u043a \u0432\u044b \u0431\u043e\u043b\u0435\u0435 \u044f\u0432\u043d\u043e\/\u0447\u0435\u0442\u043a\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>\u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439, \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 (\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439) \u043a\u043e\u0434:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 5; if (x &gt; 1) {     if (x % 2 !== 0) {         if (x !== undefined) {             console.log(`x is ${x}`);         } else {             console.log(`x is undefined`);         }        } else {         console.log('x is even');     } } else {     console.log('----'); }      if (x &amp; 1) {     if (x === undefined) {         console.log(`(1) x is ${x}`);     } else {         console.log('x is not undefined');      } } else {     console.log('----');  }     <\/code><\/pre>\n<h2>IF-Statement \u0432 JS \u0440\u0430\u0431\u043e\u0442\u0430 \u0438\u0437\u043d\u0443\u0442\u0440\u0438<\/h2>\n<p>\u041e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043f\u0440\u044f\u043c\u043e \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e ECMAScript, \u043f\u0443\u0441\u0442\u044c \u0435\u0441\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">if (exp) Statement else Statement<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0436\u0435 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438:<\/p>\n<ul>\n<li>\n<p>\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 exp \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/p>\n<p><code>expRef = Evaluation(exp)<\/code><\/p>\n<p>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 expRef \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0432 \u0431\u0443\u043b\u0435\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<br \/>expVal = ToBoolean(GetValue(expRef))<\/p>\n<p>\u0447\u0435\u0440\u0435\u0437 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e ToBoolean. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 expRef.<\/p>\n<p><u>\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 ToBoolean \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/u><\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0440\u0430\u0431\u043e\u0442\u0430 ToBoolean \u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Boolean, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 Falsy Values (undefined, null, +-0, 0, NaN \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430), \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f false.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f true.<\/p>\n<\/li>\n<\/ul>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 expVal \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043b\u0438\u0431\u043e true, \u043b\u0438\u0431\u043e false.<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0442\u0435\u043c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u043e (\u0442\u043e \u0435\u0441\u0442\u044c true), \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043f\u0435\u0440\u0432\u044b\u0439 Statement (\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u043b\u043e\u043a \u043f\u043e\u0441\u043b\u0435 if).<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043b\u043e\u0436\u043d\u043e (\u0442\u043e \u0435\u0441\u0442\u044c false) \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0443\u0436\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 Statement (\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u043b\u043e\u043a else).<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u0447\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a stmtCompletion<\/p>\n<p><code>stmtCompletion = Completion(Evaluation(Statement))<\/code><\/p>\n<ul>\n<li>\n<p>stmt &#8212; \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 &#171;Statement&#187; (\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435). \u0418 \u0432\u043e \u0432\u0441\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 ECMAScript &#8212; \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 Statement &#8212; \u044d\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0410 \u0432\u043e\u0442 stmtCompletion \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 Completion Record, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e Statement.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0438\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 &#171;Completion Record&#187;<\/figcaption><\/div>\n<\/figure>\n<p><u>Completion Record \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437:<\/u><\/p>\n<ul>\n<li>\n<p>[[Type]] &#8212; \u044d\u0442\u043e \u0442\u0438\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 normal, break, ..).<\/p>\n<\/li>\n<li>\n<p>[[Value]]- \u0432\u043e\u0437\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (empty, \u0435\u0441\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f).<\/p>\n<\/li>\n<li>\n<p>[[Target]] &#8212; \u043c\u0435\u0442\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0438\u0434\u0435\u0442 \u0432\u043e<\/p>\n<p>Return ? UpdateEmpty(stmtCompletion, undefined)<\/p>\n<p>\u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0435\u0439, \u0447\u0442\u043e \u0442\u0430\u043c \u043d\u0435 empty (\u0435\u0441\u043b\u0438 \u043f\u0443\u0441\u0442\u043e, \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f undefined)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435-2.<\/strong><\/p>\n<blockquote>\n<p>\u0418 \u0432\u043e\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u0435\u0441\u043b\u0438 \u0431\u043b\u043e\u043a ELSE \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c, \u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043b\u043e\u0436\u043d\u043e, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0435\u0440\u043d\u0435\u0442 <strong>undefined<\/strong>.<\/p>\n<\/blockquote>\n<h2>\u0410 \u043a\u0430\u043a \u0436\u0435 \u043d\u0430\u0448\u0435 ELSE IF??<\/h2>\n<p><strong>ELSE IF (\u043a\u0430\u043a \u0435\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 &#171;\u0438\u043d\u0430\u0447\u0435 \u0435\u0441\u043b\u0438&#187;)<\/strong> &#8212; \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. ELSE IF &#8212; \u044d\u0442\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e ELSE \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e IF, \u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u044d\u0442\u0430 \u0432\u0441\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e ELSE IF &#8212; \u044d\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 else \u0441 \u043d\u043e\u0432\u044b\u043c if \u0432\u043d\u0443\u0442\u0440\u0438, \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043e\u043f. \u0443\u0441\u043b\u043e\u0432\u0438\u0439.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 6;  if (x &gt; 0) {     ++x;     console.log(x); } else if (x &lt; 0) {     --x;     console.log(x); } else {     x *= 47127     console.log(x); }<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435-3.<\/strong><\/p>\n<blockquote>\n<p>\u0415\u0449\u0435 \u043a\u0441\u0442\u0430\u0442\u0438 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b.<\/p>\n<\/blockquote>\n<h2>\u0422\u0435\u0440\u043c\u0438\u043d &#171;\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438&#187;<\/h2>\n<p>\u0411\u0435\u0437 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 if \u0443\u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0442\u0435\u043b\u043e\u043c, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438  \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p><strong>\u0418 \u0432\u043e\u0442 \u0432\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"javascript\">let x = 23714;  if (x &gt; 0)     x += 34815;     x *= -1;  console.log(x); \/\/ -58529<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435\u043c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0434\u0435\u0442 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435\u043c. \u0422\u0430\u043a \u0432\u043e\u0442 *= -1 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u0434\u0430! \u0410 += 34815 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f.<\/p>\n<p>\u0418 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 (\u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0447\u0442\u043e\u0431\u044b *= \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f) \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 &#8212; \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044f \u043b\u043e\u0433\u0438\u043a\u0443 &#8212; \u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0443\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0430\u0432\u0434\u0430:<\/p>\n<pre><code class=\"javascript\">let x = 23714;  if (x &lt; 0) {     x += 34815;     x *= -1; }      console.log(x); \/\/ 23714<\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0431\u0435\u0437 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a<\/h2>\n<ul>\n<li>\n<p>dangling else<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0434\u0440\u0443\u0433\u0438\u0435..<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435 (\u0438 \u0441\u043e\u0432\u0435\u0442):<\/strong><\/p>\n<blockquote>\n<p>\u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 {..} !!!<\/p>\n<\/blockquote>\n<h2>\u041d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/h2>\n<p>\u0420\u0430\u0437 \u0443\u0436 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0438\u0445 \u0432\u044b\u0448\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438 \u0442\u0443\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f. \u041a\u0430\u043a \u0432\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0443\u0434\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0439\u0434\u0435\u0442 \u0432 if, \u0438\u043b\u0438 \u0436\u0435 \u0432 else? \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 &#8212; \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code class=\"javascript\">if (1 &amp;&amp; \"abcd\" &amp;&amp; 12) {     console.log(1); } else {     console.log(2); }<\/code><\/pre>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 (<em>\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0434\u0443\u043c\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 70-90% js-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043c\u0435\u043d\u044f \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043d\u0435\u0442<\/em>), \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 if, \u0438 \u0442\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 1 &#8212; \u044d\u0442\u043e true, &#171;abcd&#187; &#8212; true, 12 &#8212; \u044d\u0442\u043e \u0442\u043e\u0436\u0435 true -&gt; \u0437\u043d\u0430\u0447\u0438\u0442 true &amp;&amp; true &amp;&amp; true -&gt; \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u0430\u0435\u0442 \u043d\u0430\u043c true. \u041e\u0439 \u043a\u0430\u043a \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u0443 \u043d\u0430\u0441 \u0418\u0421\u0422\u0418\u041d\u0410, \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 if, \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0446\u0438\u0444\u0440\u0443 1.<\/p>\n<p><strong>\u041d\u041e<\/strong><\/p>\n<p>\u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0442\u0430\u043a! \u0412\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 IF-Statement.. \u0434\u0430-\u0434\u0430 \u0442\u043e \u0447\u0442\u043e \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432\u044b\u0448\u0435 \u043f\u0440\u043e Evaluation, \u043f\u0440\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 ToBoolean \u0438 \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<ul>\n<li>\n<p>\u0431\u0435\u0440\u0435\u0442\u0441\u044f exp<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f expRef<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f expVal \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442 ToBoolean(GetValue(expRef))<\/p>\n<\/li>\n<\/ul>\n<p><u>\u0418\u0442\u0430\u043a, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/u><\/p>\n<ul>\n<li>\n<p>\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u0430\u043a\u043e\u0435 \u0443 \u043d\u0430\u0441 exp<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441\u043b\u0435\u0432\u0430 1 &amp;&amp; &#171;abcd&#187; <\/p>\n<ul>\n<li>\n<p>\u043f\u043e ToBoolean(1) &#8212;&gt; true<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e ToBoolean(&#171;abcd&#187;) &#8212;&gt; true<\/p>\n<p>\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0443 \u043d\u0430\u0441 true &amp;&amp; true &#8212; \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0435\u0441\u043b\u0438 \u0441\u043b\u0435\u0432\u0430 \u0441\u0442\u043e\u0438\u0442 true, \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c. \u0418 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u044b \u043d\u0435 true, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#171;abcd&#187;.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0443\u0436\u0435 &#171;abcd&#187; &amp;&amp; 12<\/p>\n<ul>\n<li>\n<p>ToBoolean(&#171;abcd&#187;) &#8212;&gt; true<\/p>\n<\/li>\n<li>\n<p>ToBoolean(12) &#8212;&gt; true<\/p>\n<p>\u0441\u043b\u0435\u0432\u0430 \u0441\u043d\u043e\u0432\u0430 \u0441\u0442\u043e\u0438\u0442 true \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 12.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u0448 exp=12<\/p>\n<\/li>\n<li>\n<p>ToBoolean(12) &#8212;&gt; true &#8212; \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 if.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/897884\/\"> https:\/\/habr.com\/ru\/articles\/897884\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-454910","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=454910"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454910\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=454910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=454910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=454910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}