{"id":307243,"date":"2020-07-21T09:00:23","date_gmt":"2020-07-21T09:00:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307243"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307243","title":{"rendered":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 JavaScript"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/511742\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4w\/km\/l0\/4wkml0lzn7fzve0f7nzunyuljka.png\"><\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0434\u0440\u0443\u0437\u044c\u044f! <\/p>\n<p>  \u041c\u043d\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e JavaScript \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u044b\u043c. \u0421\u043a\u043e\u0440\u0435\u0435, \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a Node.js \u0438\u043b\u0438 PHP. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, JavaScript \u0443\u043c\u0435\u0435\u0442 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c (\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c), \u0442\u0430\u043a \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0438\u043f\u044b \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438. <\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0440\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ul>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e \u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 txt \u0438 pdf<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 JSON-\u0444\u0430\u0439\u043b\u043e\u0432<\/li>\n<li>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0432\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b: \u043e\u0434\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b (\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON), \u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0412\u0430\u043c \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043c\u043d\u043e\u0439. <\/p>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/harryheman\/Work-With-Files-in-JavaScript\" rel=\"nofollow\">GitHub<\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b<\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 \u00abWork-With-Files-in-JavaScript\u00bb \u0438\u043b\u0438 \u043a\u0430\u043a \u0412\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0433\u043e\u0434\u043d\u043e. <\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 \u00abFile-Reader\u00bb. <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432 \u043d\u0435\u0439 \u0444\u0430\u0439\u043b \u00abindex.html\u00bb \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"xml\">&lt;div&gt;+&lt;\/div&gt; &lt;input type=&quot;file&quot;&gt; <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440-\u0444\u0430\u0439\u043b\u043e\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a \u0438 \u0438\u043d\u043f\u0443\u0442 \u0441 \u0442\u0438\u043f\u043e\u043c \u00abfile\u00bb (\u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430; \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438; \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043d\u043f\u0443\u0442\u0443 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u00abmultiple\u00bb), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0440\u044f\u0442\u0430\u043d \u043f\u043e\u0434 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c. <\/p>\n<p>  \u0421\u0442\u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c \u0438\u043b\u0438 \u0432 \u0442\u0435\u0433\u0435 \u00abstyle\u00bb \u0432\u043d\u0443\u0442\u0440\u0438 head:<\/p>\n<pre><code class=\"css\">body {     margin: 0 auto;     display: flex;     justify-content: center;     align-items: center;     min-height: 100vh;     max-width: 768px;     background: radial-gradient(circle, skyblue, steelblue);     color: #222; }  div {     width: 150px;     height: 150px;     display: flex;     justify-content: center;     align-items: center;     font-size: 10em;     font-weight: bold;     border: 6px solid;     border-radius: 8px;     user-select: none;     cursor: pointer; }  input {     display: none; }  img, audio, video {     max-width: 80vw;     max-height: 80vh; } <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0437\u0430\u0439\u043d \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0432\u043a\u0443\u0441\u0443. <\/p>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043b\u0438\u0431\u043e \u0432 head \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c \u00abdefer\u00bb (\u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 (\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430) DOM; \u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u00abload\u00bb \u0438\u043b\u0438 \u00abDOMContentLoaded\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u00abwindow\u00bb, \u043d\u043e defer \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043e\u0447\u0435), \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u0442\u0435\u0433\u043e\u043c \u00abbody\u00bb (\u0442\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043d\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a). \u041b\u0438\u0447\u043d\u043e \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. <\/p>\n<p>  \u041e\u0442\u043a\u0440\u043e\u0435\u043c index.html \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ez\/em\/3u\/ezem3uasmqorzr9oj-9rd3foazc.png\"><\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e, \u0442\u0435\u043a\u0441\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 txt, pdf \u0438 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, doc. \u041c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/harryheman\/Work-With-Files-in-JavaScript\/tree\/master\/File-Reader\/src\" rel=\"nofollow\">\u043c\u043e\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e<\/a> \u0438\u043b\u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u044e. <\/p>\n<p>  \u041d\u0430\u043c \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u00abdocument\u00bb \u0438 \u00abdocument.body\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0432 \u0442\u0430\u043a\u043e\u0435 IIFE (\u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e):<\/p>\n<pre><code class=\"javascript\">;((D, B, log = arg =&gt; console.log(arg)) =&gt; {      \/\/ \u043d\u0430\u0448 \u043a\u043e\u0434      \/\/ \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a document \u0438 document.body \u043a\u0430\u043a \u043a D \u0438 B, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e     \/\/ log = arg =&gt; console.log(arg) - \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e     \/\/ \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c console.log \u043a\u0430\u043a log })(document, document.body) <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430, \u0438\u043d\u043f\u0443\u0442\u0430 \u0438 \u0444\u0430\u0439\u043b\u0430 (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u2014 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0438\u043a \u043f\u043e \u0438\u043d\u043f\u0443\u0442\u0443 \u0438\u043b\u0438 \u0431\u0440\u043e\u0441\u0430\u043d\u0438\u0435 (drop) \u0432 \u0444\u0430\u0439\u043b\u043e\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a):  <\/p>\n<pre><code class=\"javascript\">const dropZone = D.querySelector('div') const input = D.querySelector('input') let file <\/code><\/pre>\n<p>  \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u00abdragover\u00bb \u0438 \u00abdrop\u00bb \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">D.addEventListener('dragover', ev =&gt; ev.preventDefault()) D.addEventListener('drop', ev =&gt; ev.preventDefault()) <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0437\u0430\u0447\u0435\u043c \u043c\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0430\u0439\u043b \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442. \u0410 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u0442.\u0435. \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. <\/p>\n<p>  \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0431\u0440\u043e\u0441\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0444\u0430\u0439\u043b\u043e\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a:<\/p>\n<pre><code class=\"javascript\">dropZone.addEventListener('drop', ev =&gt; {     \/\/ \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e     ev.preventDefault()      \/\/ \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c     log(ev.dataTransfer)      \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f)     \/*     DataTransfer {dropEffect: &quot;none&quot;, effectAllowed: &quot;all&quot;, items: DataTransferItemList, types: Array(1), files: FileList}         dropEffect: &quot;none&quot;         effectAllowed: &quot;all&quot;     =&gt;  files: FileList             length: 0         __proto__: FileList         items: DataTransferItemList {length: 0}         types: []         __proto__: DataTransfer     *\/      \/\/ \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u043d\u0430\u0441 \u043e\u0431\u044a\u0435\u043a\u0442 (File) \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 &quot;files&quot; \u043e\u0431\u044a\u0435\u043a\u0442\u0430 &quot;DataTransfer&quot;     \/\/ \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0435\u0433\u043e     file = ev.dataTransfer.files[0]      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     log(file)     \/*     File {name: &quot;image.png&quot;, lastModified: 1593246425244, lastModifiedDate: Sat Jun 27 2020 13:27:05 GMT+0500 (\u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f), webkitRelativePath: &quot;&quot;, size: 208474, \u2026}         lastModified: 1593246425244         lastModifiedDate: Sat Jun 27 2020 13:27:05 GMT+0500 (\u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f) {}         name: &quot;image.png&quot;         size: 208474         type: &quot;image\/png&quot;         webkitRelativePath: &quot;&quot;         __proto__: File     *\/      \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438     handleFile(file) }) <\/code><\/pre>\n<p>  \u041c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u00abdran&#8217;n&#8217;drop\u00bb.<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043b\u0438\u043a \u043f\u043e \u0444\u0430\u0439\u043b\u043e\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0443 (\u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u0438\u043a \u0438\u043d\u043f\u0443\u0442\u0443):<\/p>\n<pre><code class=\"javascript\">dropZone.addEventListener('click', () =&gt; {     \/\/ \u043a\u043b\u0438\u043a\u0430\u0435\u043c \u043f\u043e \u0441\u043a\u0440\u044b\u0442\u043e\u043c\u0443 \u0438\u043d\u043f\u0443\u0442\u0443     input.click()      \/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u043f\u0443\u0442\u0430     input.addEventListener('change', () =&gt; {         \/\/ \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c         log(input.files)          \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f)         \/*         FileList {0: File, length: 1}         =&gt;  0: File                 lastModified: 1593246425244                 lastModifiedDate: Sat Jun 27 2020 13:27:05 GMT+0500 (\u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f) {}                 name: &quot;image.png&quot;                 size: 208474                 type: &quot;image\/png&quot;                 webkitRelativePath: &quot;&quot;                 __proto__: File             length: 1             __proto__: FileList         *\/          \/\/ \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c File         file = input.files[0]          \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c         log(file)                  \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438         handleFile(file)     }) }) <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"javascript\">const handleFile = file =&gt; {     \/\/ \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f } <\/code><\/pre>\n<p>  \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a \u0438 \u0438\u043d\u043f\u0443\u0442:<\/p>\n<pre><code class=\"javascript\">dropZone.remove() input.remove() <\/code><\/pre>\n<p>  \u0421\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0435\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<pre><code class=\"javascript\">log(file.type) \/\/ \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \/\/ image\/png <\/code><\/pre>\n<p>  \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 html, css \u0438 js-\u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443:<\/p>\n<pre><code class=\"javascript\">if (file.type === 'text\/html' ||     file.type === 'text\/css' ||     file.type === 'text\/javascript') return; <\/code><\/pre>\n<p>  \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 MS-\u0444\u0430\u0439\u043b\u0430\u043c\u0438 (\u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438 MIME-\u0442\u0438\u043f \u00abapplication\/msword\u00bb, \u00abapplication\/vnd.ms-excel\u00bb \u0438 \u0442.\u0434.), \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0445 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438. \u0412\u0441\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0430\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0435 \u043d\u0430 StackOverflow \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445, \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u043a \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043b\u0438\u0431\u043e \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e viewer&#8217;\u043e\u0432 \u043e\u0442 Google \u0438 Microsoft, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0445\u043e\u0442\u044f\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0438 localhost. \u0412\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c, \u0442\u0438\u043f pdf-\u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u00abapplication\u00bb, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e: <\/p>\n<pre><code class=\"javascript\">if (file.type === 'application\/pdf') {     createIframe(file)     return; } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0445 \u00ab\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0439\u00bb \u0442\u0438\u043f:<\/p>\n<pre><code class=\"javascript\">\/\/ \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043e \u0441\u043b\u0435\u0448\u0430 const type = file.type.replace(\/\\\/.+\/, '')  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c log(type) \/\/ \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \/\/ image <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c switch..case \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"javascript\">switch (type) {     \/\/ \u0435\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435     case 'image':         createImage(file)         break;     \/\/ \u0435\u0441\u043b\u0438 \u0430\u0443\u0434\u0438\u043e     case 'audio':         createAudio(file)         break;     \/\/ \u0435\u0441\u043b\u0438 \u0432\u0438\u0434\u0435\u043e     case 'video':         createVideo(file)         break;     \/\/ \u0435\u0441\u043b\u0438 \u0442\u0435\u043a\u0441\u0442     case 'text':         createText(file)         break;     \/\/ \u0438\u043d\u0430\u0447\u0435, \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0444\u0430\u0439\u043b\u0430,     \/\/ \u0438 \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443     default:         B.innerHTML = `&lt;h3&gt;Unknown File Format!&lt;\/h3&gt;`         const timer = setTimeout(() =&gt; {             location.reload()             clearTimeout(timer)         }, 2000)         break; } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const createImage = image =&gt; {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &quot;img&quot;     const imageEl = D.createElement('img')     \/\/ \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e     imageEl.src = URL.createObjectURL(image)     \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     log(imageEl)     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442     B.append(imageEl)     \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b     URL.revokeObjectURL(image) } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0443\u0434\u0438\u043e:<\/p>\n<pre><code class=\"javascript\">const createAudio = audio =&gt; {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &quot;audio&quot;     const audioEl = D.createElement('audio')     \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u043d\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f     audioEl.setAttribute('controls', '')     \/\/ \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443     audioEl.src = URL.createObjectURL(audio)     \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     log(audioEl)     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442     B.append(audioEl)     \/\/ \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435     audioEl.play()     \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b     URL.revokeObjectURL(audio) } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0438\u0434\u0435\u043e:<\/p>\n<pre><code class=\"javascript\">const createVideo = video =&gt; {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &quot;video&quot;     const videoEl = D.createElement('video')     \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u043d\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f     videoEl.setAttribute('controls', '')     \/\/ \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435     videoEl.setAttribute('loop', 'true')     \/\/ \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443     videoEl.src = URL.createObjectURL(video)     \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     log(videoEl)     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442     B.append(videoEl)     \/\/ \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435     videoEl.play()     \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b     URL.revokeObjectURL(video) } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">const createText = text =&gt; {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 &quot;FileReader&quot;     const reader = new FileReader()     \/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442     \/\/ \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430     \/\/ \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - utf-8,     \/\/ \u043d\u043e \u043e\u043d\u0430 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0443     reader.readAsText(text, 'windows-1251')     \/\/ \u0434\u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430     \/\/ \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442     reader.onload = () =&gt; B.innerHTML = `&lt;p&gt;&lt;pre&gt;${reader.result}&lt;\/pre&gt;&lt;\/p&gt;` } <\/code><\/pre>\n<p>  Last, but not least, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 pdf-\u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">const createIframe = pdf =&gt; {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &quot;iframe&quot;     const iframe = D.createElement('iframe')     \/\/ \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443     iframe.src = URL.createObjectURL(pdf)     \/\/ \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u043e \u0448\u0438\u0440\u0438\u043d\u044b \u0438 \u0432\u044b\u0441\u043e\u0442\u044b \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430     iframe.width = innerWidth     iframe.height = innerHeight     \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     log(iframe)     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442     B.append(iframe)     \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b     URL.revokeObjectURL(pdf) } <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 300px; position: relative;\"><iframe src=\"https:\/\/codepen.io\/harryheman\/embed\/preview\/BajvQmB?height=300&amp;slug-hash=BajvQmB&amp;default-tabs=js%2Cresult&amp;host=https%3A%2F%2Fcodepen.io\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen><\/iframe><\/div>\n<\/div>\n<\/div>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c JSON-\u0444\u0430\u0439\u043b<\/h3>\n<p>  \u0414\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 \u00abCreate-JSON\u00bb \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 (Work-With-Files-in-JavaScript).<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u00abindex.html\u00bb \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"xml\">&lt;!-- head --&gt; &lt;!-- materialize css --&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/materialize\/1.0.0\/css\/materialize.min.css&quot;&gt; &lt;!-- material icons --&gt; &lt;link href=&quot;https:\/\/fonts.googleapis.com\/icon?family=Material+Icons&quot; rel=&quot;stylesheet&quot;&gt;  &lt;!-- body --&gt; &lt;h3&gt;Create JSON&lt;\/h3&gt;  &lt;!-- \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 --&gt; &lt;div class=&quot;row main&quot;&gt;     &lt;h3&gt;Create JSON&lt;\/h3&gt;     &lt;form class=&quot;col s12&quot;&gt;         &lt;!-- \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0430\u0440\u0430 &quot;\u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&quot; --&gt;         &lt;div class=&quot;row&quot;&gt;             &lt;div class=&quot;input-field col s5&quot;&gt;                 &lt;label&gt;key&lt;\/label&gt;                 &lt;input type=&quot;text&quot; value=&quot;1&quot; required&gt;             &lt;\/div&gt;             &lt;div class=&quot;input-field col s2&quot;&gt;                 &lt;p&gt;:&lt;\/p&gt;             &lt;\/div&gt;             &lt;div class=&quot;input-field col s5&quot;&gt;                 &lt;label&gt;value&lt;\/label&gt;                 &lt;input type=&quot;text&quot; value=&quot;foo&quot; required&gt;             &lt;\/div&gt;         &lt;\/div&gt;          &lt;!-- \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0430\u0440\u0430 --&gt;         &lt;div class=&quot;row&quot;&gt;             &lt;div class=&quot;input-field col s5&quot;&gt;                 &lt;label&gt;key&lt;\/label&gt;                 &lt;input type=&quot;text&quot; value=&quot;2&quot; required&gt;             &lt;\/div&gt;             &lt;div class=&quot;input-field col s2&quot;&gt;                 &lt;p&gt;:&lt;\/p&gt;             &lt;\/div&gt;             &lt;div class=&quot;input-field col s5&quot;&gt;                 &lt;label&gt;value&lt;\/label&gt;                 &lt;input type=&quot;text&quot; value=&quot;bar&quot; required&gt;             &lt;\/div&gt;         &lt;\/div&gt;                  &lt;!-- \u0442\u0440\u0435\u0442\u044c\u044f \u043f\u0430\u0440\u0430 --&gt;         &lt;div class=&quot;row&quot;&gt;             &lt;div class=&quot;input-field col s5&quot;&gt;                 &lt;label&gt;key&lt;\/label&gt;                 &lt;input type=&quot;text&quot; value=&quot;3&quot; required&gt;             &lt;\/div&gt;             &lt;div class=&quot;input-field col s2&quot;&gt;                 &lt;p&gt;:&lt;\/p&gt;             &lt;\/div&gt;             &lt;div class=&quot;input-field col s5&quot;&gt;                 &lt;label&gt;value&lt;\/label&gt;                 &lt;input type=&quot;text&quot; value=&quot;baz&quot; required&gt;             &lt;\/div&gt;         &lt;\/div&gt;          &lt;!-- \u043a\u043d\u043e\u043f\u043a\u0438 --&gt;         &lt;div class=&quot;row&quot;&gt;             &lt;button class=&quot;btn waves-effect waves-light create-json&quot;&gt;create json                 &lt;i class=&quot;material-icons right&quot;&gt;send&lt;\/i&gt;             &lt;\/button&gt;             &lt;a class=&quot;waves-effect waves-light btn get-data&quot;&gt;&lt;i class=&quot;material-icons right&quot;&gt;cloud&lt;\/i&gt;get data&lt;\/a&gt;         &lt;\/div&gt;     &lt;\/form&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/materializecss.com\/\" rel=\"nofollow\">Materialize<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yu\/er\/iw\/yueriwd-m0-xz4ytalbzuduseea.png\"><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u043e\u0447\u043a\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439:<\/p>\n<pre><code class=\"css\">body {     max-width: 512px;     margin: 0 auto;     text-align: center; }  input {     text-align: center; }  .get-data {     margin-left: 1em; } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wk\/si\/hw\/wksihwi59_ooefzoy7at9dvwzv0.png\"><\/p>\n<p>  JSON-\u0444\u0430\u0439\u043b\u044b \u0438\u043c\u0435\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442:<\/p>\n<pre><code class=\"javascript\">{     &quot;\u043a\u043b\u044e\u0447&quot;: &quot;\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&quot;,     &quot;\u043a\u043b\u044e\u0447&quot;: &quot;\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&quot;,     ... } <\/code><\/pre>\n<p>  \u041d\u0435\u0447\u0435\u0442\u043d\u044b\u0435 \u0438\u043d\u043f\u0443\u0442\u044b \u0441 \u0442\u0438\u043f\u043e\u043c \u00abtext\u00bb \u2014 \u043a\u043b\u044e\u0447\u0438, \u0447\u0435\u0442\u043d\u044b\u0435 \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0438\u043d\u043f\u0443\u0442\u0430\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c\u0438). \u041a\u043d\u043e\u043f\u043a\u0430 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u00abcreate-json\u00bb \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430. \u041a\u043d\u043e\u043f\u043a\u0430 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u00abget-data\u00bb \u2014 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0443:<\/p>\n<pre><code class=\"javascript\">\/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c &quot;create-json&quot; \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 document.querySelector('.create-json').addEventListener('click', ev =&gt; {     \/\/ \u043b\u044e\u0431\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f &quot;submit&quot; \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442.\u0435. \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440     \/\/ \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0444\u043e\u0440\u043c\u044b \u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b     \/\/ \u043d\u0430\u043c \u044d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435     ev.preventDefault()      \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u0438\u043d\u043f\u0443\u0442\u044b     const inputs = document.querySelectorAll('input')      \/\/ \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c     \/\/ \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438     \/\/ \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c      \/\/ \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 &quot;chunk&quot; \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 &quot;lodash&quot;     \/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0445 \u0438\u043d\u043f\u0443\u0442\u043e\u0432 (\u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0438 \u043f\u044f\u0442\u043e\u0433\u043e) - \u043a\u043b\u044e\u0447\u0438     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0438\u0445 \u0432 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432     \/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0435\u0442\u043d\u044b\u0445 \u0438\u043d\u043f\u0443\u0442\u043e\u0432 (\u0432\u0442\u043e\u0440\u043e\u0433\u043e, \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0433\u043e \u0438 \u0448\u0435\u0441\u0442\u043e\u0433\u043e) - \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0438\u0445 \u0432 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432     const arr = []     for (let i = 0; i &lt; inputs.length; ++i) {         arr.push([inputs[i].value, inputs[++i].value])     }      \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432     console.log(arr)     \/*          [             [&quot;1&quot;, &quot;foo&quot;]             [&quot;2&quot;, &quot;bar&quot;]             [&quot;3&quot;, &quot;baz&quot;]         ]     *\/      \/\/ \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442     const data = Object.fromEntries(arr)      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     console.log(data)     \/*          {             1: &quot;foo&quot;             2: &quot;bar&quot;             3: &quot;baz&quot;         }     *\/          \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b     const file = new Blob(         \/\/ \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435         [JSON.stringify(data)], {             type: 'application\/json'         }     )          \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     console.log(file)     \/*          {             &quot;1&quot;: &quot;foo&quot;,             &quot;2&quot;: &quot;bar&quot;,             &quot;3&quot;: &quot;baz&quot;         }     *\/     \/\/ \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043a\u0442\u043e\u0440 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &quot;a&quot;     const link = document.createElement('a')     \/\/ \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 &quot;href&quot; \u0442\u0435\u0433\u0430 &quot;a&quot; \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443     link.setAttribute('href', URL.createObjectURL(file))     \/\/ \u0430\u0442\u0440\u0438\u0431\u0443\u0442 &quot;download&quot; \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430     \/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430     link.setAttribute('download', 'data.json')     \/\/ \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0441\u044b\u043b\u043a\u0438     link.textContent = 'DOWNLOAD DATA'     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c &quot;main&quot;     document.querySelector('.main').append(link)     \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b     URL.revokeObjectURL(file)      \/\/ { once: true } \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f     \/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u043a\u043b\u0438\u043a \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b }, { once: true }) <\/code><\/pre>\n<p>  \u041f\u043e \u043a\u043b\u0438\u043a\u0443 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0435 \u00abCREATE JSON\u00bb \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u00abdata.json\u00bb, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u00abDOWNLOAD DATA\u00bb \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>  \u0427\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c \u0444\u0430\u0439\u043b\u043e\u043c? \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u00abCreate-JSON\u00bb.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<pre><code class=\"javascript\">\/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0443 (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u0441\u044b\u043b\u043a\u0430) \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c &quot;get-data&quot; \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 document.querySelector('.get-data').addEventListener('click', () =&gt; {     \/\/ \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e IIFE \u0438 async..await \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432 \u0432\u0438\u0434\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b     (async () =&gt; {         const response = await fetch('data.json')          \/\/ \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c (\u043f\u0430\u0440\u0441\u0438\u043c) \u043e\u0442\u0432\u0435\u0442         const data = await response.json()          console.table(data)     })() }) <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 300px; position: relative;\"><iframe src=\"https:\/\/codepen.io\/harryheman\/embed\/preview\/LYGMbmJ?height=300&amp;slug-hash=LYGMbmJ&amp;default-tabs=html%2Cresult&amp;host=https%3A%2F%2Fcodepen.io\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen><\/iframe><\/div>\n<\/div>\n<\/div>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0442\u0435\u0441\u0442\u0435\u0440<\/h3>\n<p>  <\/p>\n<h5>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/h5>\n<p>  \u0414\u043b\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 \u00abTest-Maker\u00bb \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u00abcreateTest.html\u00bb \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"xml\">&lt;!-- head --&gt; &lt;!-- Bootstrap CSS --&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.0\/css\/bootstrap.min.css&quot;     integrity=&quot;sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk&quot; crossorigin=&quot;anonymous&quot;&gt;  &lt;!-- body --&gt; &lt;!-- \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 --&gt; &lt;div class=&quot;container&quot;&gt;     &lt;h3&gt;Create Test&lt;\/h3&gt;     &lt;form id=&quot;questions-box&quot;&gt;         &lt;!-- \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 --&gt;         &lt;div class=&quot;question-box&quot;&gt;             &lt;br&gt;&lt;hr&gt;             &lt;h4 class=&quot;title&quot;&gt;&lt;\/h4&gt;             &lt;!-- \u0432\u043e\u043f\u0440\u043e\u0441 --&gt;             &lt;div class=&quot;row&quot;&gt;                 &lt;input type=&quot;text&quot; class=&quot;form-control col-11 question-text&quot; value=&quot;first question&quot; &gt;                 &lt;!-- \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430--&gt;                 &lt;button class=&quot;btn btn-danger col remove-question-btn&quot;&gt;X&lt;\/button&gt;             &lt;\/div&gt;             &lt;hr&gt;              &lt;h4&gt;Answers:&lt;\/h4&gt;             &lt;!-- \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u0432\u0435\u0442\u043e\u0432 --&gt;             &lt;div class=&quot;row answers-box&quot;&gt;                 &lt;!-- \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 --&gt;                 &lt;div class=&quot;input-group&quot;&gt;                     &lt;div class=&quot;input-group-prepend&quot;&gt;                         &lt;div class=&quot;input-group-text&quot;&gt;                             &lt;input type=&quot;radio&quot; checked name=&quot;answer&quot;&gt;                         &lt;\/div&gt;                     &lt;\/div&gt;                      &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; value=&quot;foo&quot; &gt;                      &lt;!-- \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 --&gt;                     &lt;div class=&quot;input-group-append&quot;&gt;                         &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;                     &lt;\/div&gt;                 &lt;\/div&gt;                 &lt;!-- \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 --&gt;                 &lt;div class=&quot;input-group&quot;&gt;                     &lt;div class=&quot;input-group-prepend&quot;&gt;                         &lt;div class=&quot;input-group-text&quot;&gt;                             &lt;input type=&quot;radio&quot; name=&quot;answer&quot;&gt;                         &lt;\/div&gt;                     &lt;\/div&gt;                      &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; value=&quot;bar&quot; &gt;                      &lt;div class=&quot;input-group-append&quot;&gt;                         &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;                     &lt;\/div&gt;                 &lt;\/div&gt;                 &lt;!-- \u0442\u0440\u0435\u0442\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 --&gt;                 &lt;div class=&quot;input-group&quot;&gt;                     &lt;div class=&quot;input-group-prepend&quot;&gt;                         &lt;div class=&quot;input-group-text&quot;&gt;                             &lt;input type=&quot;radio&quot; name=&quot;answer&quot;&gt;                         &lt;\/div&gt;                     &lt;\/div&gt;                      &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; value=&quot;baz&quot; &gt;                      &lt;div class=&quot;input-group-append&quot;&gt;                         &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;                     &lt;\/div&gt;                 &lt;\/div&gt;             &lt;\/div&gt;             &lt;br&gt;              &lt;!-- \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 --&gt;             &lt;button class=&quot;btn btn-primary add-answer-btn&quot;&gt;Add answer&lt;\/button&gt;             &lt;hr&gt;              &lt;h4&gt;Explanation:&lt;\/h4&gt;             &lt;!-- \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 --&gt;             &lt;div class=&quot;row explanation-box&quot;&gt;                 &lt;input type=&quot;text&quot; value=&quot;first explanation&quot; class=&quot;form-control explanation-text&quot; &gt;             &lt;\/div&gt;         &lt;\/div&gt;     &lt;\/form&gt;      &lt;br&gt;      &lt;!-- \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430 --&gt;     &lt;button class=&quot;btn btn-primary&quot; id=&quot;add-question-btn&quot;&gt;Add question&lt;\/button&gt;     &lt;button class=&quot;btn btn-primary&quot; id=&quot;create-test-btn&quot;&gt;Create test&lt;\/button&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0434\u043b\u044f \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/getbootstrap.com\/\" rel=\"nofollow\">Bootstrap<\/a>. \u041c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u00abrequired\u00bb, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0431\u0443\u0434\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0432 JS (\u0441 required \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u043c).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/av\/gi\/yv\/avgiyvk-ajdjjf8mxxa_xugcwbm.png\"><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u043e\u0447\u043a\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439: <\/p>\n<pre><code class=\"css\">body {         max-width: 512px;         margin: 0 auto;         text-align: center;     }  input[type=&quot;radio&quot;] {     cursor: pointer; } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3k\/v0\/sg\/3kv0sgzoqscnld3dedw_x7whmak.png\"><\/p>\n<p>  \u0423 \u043d\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u043e\u043f\u0440\u043e\u0441\u0430. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u00abQuestion.js\u00bb \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f: <\/p>\n<pre><code class=\"javascript\">export default (name = Date.now()) =&gt; ` &lt;div class=&quot;question-box&quot;&gt;     &lt;br&gt;&lt;hr&gt;     &lt;h4 class=&quot;title&quot;&gt;&lt;\/h4&gt;     &lt;div class=&quot;row&quot;&gt;         &lt;input type=&quot;text&quot; class=&quot;form-control col-11 question-text&quot;&gt;         &lt;button class=&quot;btn btn-danger col remove-question-btn&quot;&gt;X&lt;\/button&gt;     &lt;\/div&gt;     &lt;hr&gt;     &lt;h4&gt;Answers:&lt;\/h4&gt;     &lt;div class=&quot;row answers-box&quot;&gt;         &lt;div class=&quot;input-group&quot;&gt;             &lt;div class=&quot;input-group-prepend&quot;&gt;                 &lt;div class=&quot;input-group-text&quot;&gt;                     &lt;input type=&quot;radio&quot; checked name=&quot;${name}&quot;&gt;                 &lt;\/div&gt;             &lt;\/div&gt;              &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; &gt;              &lt;div class=&quot;input-group-append&quot;&gt;                 &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;             &lt;\/div&gt;         &lt;\/div&gt;         &lt;div class=&quot;input-group&quot;&gt;             &lt;div class=&quot;input-group-prepend&quot;&gt;                 &lt;div class=&quot;input-group-text&quot;&gt;                     &lt;input type=&quot;radio&quot; name=&quot;${name}&quot;&gt;                 &lt;\/div&gt;             &lt;\/div&gt;              &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; &gt;              &lt;div class=&quot;input-group-append&quot;&gt;                 &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;             &lt;\/div&gt;         &lt;\/div&gt;         &lt;div class=&quot;input-group&quot;&gt;             &lt;div class=&quot;input-group-prepend&quot;&gt;                 &lt;div class=&quot;input-group-text&quot;&gt;                     &lt;input type=&quot;radio&quot; name=&quot;${name}&quot;&gt;                 &lt;\/div&gt;             &lt;\/div&gt;              &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; &gt;              &lt;div class=&quot;input-group-append&quot;&gt;                 &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;             &lt;\/div&gt;         &lt;\/div&gt;     &lt;\/div&gt;     &lt;br&gt;     &lt;button class=&quot;btn btn-primary add-answer-btn&quot;&gt;Add answer&lt;\/button&gt;     &lt;hr&gt;     &lt;h4&gt;Explanation:&lt;\/h4&gt;     &lt;div class=&quot;row explanation-box&quot;&gt;         &lt;input type=&quot;text&quot; class=&quot;form-control explanation-text&quot;&gt;     &lt;\/div&gt; &lt;\/div&gt; ` <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u0432 createTest.html, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0443\u0431\u0440\u0430\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0438\u043d\u043f\u0443\u0442\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u00abname\u00bb \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 (\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u2014 \u044d\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445). \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c name \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0435 \u0441 1 \u044f\u043d\u0432\u0430\u0440\u044f 1970 \u0433\u043e\u0434\u0430, \u2014 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 Nanoid, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 (\u0432\u0440\u044f\u0434 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0441\u043f\u0435\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0437\u0430 1 \u043c\u0441).<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u0443. <\/p>\n<p>  \u042f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 (\u0444\u0430\u0431\u0440\u0438\u0447\u043d\u044b\u0445) \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: <\/p>\n<pre><code class=\"javascript\">\/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u043c const findOne = (element, selector) =&gt; element.querySelector(selector) \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u043c const findAll = (element, selector) =&gt; element.querySelectorAll(selector) \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f const addHandler = (element, event, callback) =&gt; element.addEventListener(event, callback)  \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \/\/ \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c Bootstrap \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u0430\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \/\/ \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 DOM \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \/\/ \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 - \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 (\u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438), \/\/ \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f 1 const findParent = (element, depth = 1) =&gt; {     \/\/ \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438,     \/\/ \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442     let parentEl = element.parentElement      \/\/ \u0438\u043d\u0430\u0447\u0435, \u043c\u044b \u0438\u0449\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438 \u0442.\u0434. \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438     while (depth &gt; 1) {         \/\/ \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f         parentEl = findParent(parentEl)         \/\/ \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u044b         depth--     }      \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442     return parentEl } <\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u044b \u0434\u043e\u0439\u0434\u0435\u043c \u0434\u043e \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0438\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c if..else if \u0438\u043b\u0438 switch..case, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c. <\/p>\n<p>  \u0415\u0449\u0435 \u0440\u0430\u0437: \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u044b \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c.<\/p>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0444\u043e\u0440\u043c\u044b: <\/p>\n<pre><code class=\"javascript\">const C = findOne(document.body, '.container') \/\/ const C = document.body.querySelector('.container') const Q = findOne(C, '#questions-box')  addHandler(Q, 'submit', ev =&gt; ev.preventDefault()) \/\/ Q.addEventListener('submit', ev =&gt; ev.preventDefault()) <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043d\u043e\u043f\u043e\u043a \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"javascript\">\/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 const initRemoveQuestionBtn = q =&gt; {     const removeQuestionBtn = findOne(q, '.remove-question-btn')      addHandler(removeQuestionBtn, 'click', ev =&gt; {         \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043a\u043d\u043e\u043f\u043a\u0438         \/*         =&gt;  &lt;div class=&quot;question-box&quot;&gt;                 &lt;br&gt;&lt;hr&gt;                 &lt;h4 class=&quot;title&quot;&gt;&lt;\/h4&gt;             =&gt;  &lt;div class=&quot;row&quot;&gt;                     &lt;input type=&quot;text&quot; class=&quot;form-control col-11 question-text&quot; value=&quot;first question&quot; &gt;                 =&gt;  &lt;button class=&quot;btn btn-danger col remove-question-btn&quot;&gt;X&lt;\/button&gt;                 &lt;\/div&gt;                  ...         *\/         findParent(ev.target, 2).remove()         \/\/ ev.target.parentElement.parentElement.remove()          \/\/ \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432         initTitles()     }, {         \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f         once: true     }) } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043d\u043e\u043f\u043e\u043a \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">const initRemoveAnswerBtns = q =&gt; {     const removeAnswerBtns = findAll(q, '.remove-answer-btn')     \/\/ const removeAnswerBtns = q.querySelectorAll('.remove-answer-btn')      removeAnswerBtns.forEach(btn =&gt; addHandler(btn, 'click', ev =&gt; {         \/*         =&gt;  &lt;div class=&quot;input-group&quot;&gt;               ...            =&gt;  &lt;div class=&quot;input-group-append&quot;&gt;               =&gt;  &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;               &lt;\/div&gt;             &lt;\/div&gt;         *\/         findParent(ev.target, 2).remove()     }, {         once: true     })) } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043d\u043e\u043f\u043e\u043a \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">const initAddAnswerBtns = q =&gt; {     const addAnswerBtns = findAll(q, '.add-answer-btn')      addAnswerBtns.forEach(btn =&gt; addHandler(btn, 'click', ev =&gt; {         \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432         const answers = findOne(findParent(ev.target), '.answers-box')         \/\/ const answers = ev.target.parentElement.querySelector('.answers-box')          \/\/ \u0430\u0442\u0440\u0438\u0431\u0443\u0442 &quot;name&quot; \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430         let name         answers.children.length &gt; 0             ? name = findOne(answers, 'input[type=&quot;radio&quot;]').name             : name = Date.now()          \/\/ \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0430         const template = `                 &lt;div class=&quot;input-group&quot;&gt;                     &lt;div class=&quot;input-group-prepend&quot;&gt;                         &lt;div class=&quot;input-group-text&quot;&gt;                             &lt;input type=&quot;radio&quot; name=&quot;${name}&quot;&gt;                         &lt;\/div&gt;                     &lt;\/div&gt;                      &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; value=&quot;&quot;&gt;                      &lt;div class=&quot;input-group-append&quot;&gt;                         &lt;button class=&quot;btn btn-outline-danger remove-answer-btn&quot;&gt;X&lt;\/button&gt;                     &lt;\/div&gt;                 &lt;\/div&gt;                 `         \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043a\u043e\u043d\u0435\u0446 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432         answers.insertAdjacentHTML('beforeend', template)                  \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430         initRemoveAnswerBtns(q)     })) } <\/code><\/pre>\n<p>  \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043d\u043e\u043f\u043e\u043a \u0432 \u043e\u0434\u043d\u0443:<\/p>\n<pre><code class=\"javascript\">const initBtns = q =&gt; {     initRemoveQuestionBtn(q)     initRemoveAnswerBtns(q)     initAddAnswerBtns(q) } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">const initTitles = () =&gt; {     \/\/ \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0446\u0435\u043b\u044c\u044e \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430     const questions = Array.from(findAll(Q, '.question-box'))      \/\/ \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432     questions.map(q =&gt; {         const title = findOne(q, '.title')         \/\/ \u043d\u043e\u043c\u0435\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 - \u044d\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 + 1         title.textContent = `Question ${questions.indexOf(q) + 1}`     }) } <\/code><\/pre>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"javascript\">initBtns(findOne(Q, '.question-box'))  initTitles() <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430: <\/p>\n<pre><code class=\"javascript\">\/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0443 const addQuestionBtn = findOne(C, '#add-question-btn')  addHandler(addQuestionBtn, 'click', ev =&gt; {     \/\/ \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e IIFE \u0438 async..await \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430     \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432     \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441     \/\/ \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u0432\u0441\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438     (async () =&gt; {         const data = await import('.\/Question.js')         const template = await data.default()         await Q.insertAdjacentHTML('beforeend', template)          const question = findOne(Q, '.question-box:last-child')         initBtns(question)         initTitles()     })() }) <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">\/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043b\u0438\u043a \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430 addHandler(findOne(C, '#create-test-btn'), 'click', () =&gt; createTest())  const createTest = () =&gt; {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442     const obj = {}      \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b     const questions = findAll(Q, '.question-box')      \/\/ \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u044b     \/\/ \u043f\u043e\u043b\u044f \u043d\u0435 \u0434\u043e\u043b\u0436\u044b \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c\u0438     const isEmpty = (...args) =&gt; {         \/\/ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430         args.map(arg =&gt; {             \/\/ \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0434\u0432\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u043d\u0430 \u043e\u0434\u0438\u043d             \/\/ \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a\u0438             arg = arg.replace(\/\\s+\/g, '').trim()             \/\/ \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430             if (arg === '') {                 \/\/ \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e                 alert('Some field is empty!')                 \/\/ \u0438 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435                 throw new Error()             }         })     }      \/\/ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430     questions.forEach(q =&gt; {         \/\/ \u0442\u0435\u043a\u0441\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u0430         const questionText = findOne(q, '.question-text').value          \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430         \/\/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c         const answersText = []         findAll(q, '.answer-text').forEach(text =&gt; answersText.push(text.value))                  \/\/ \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 - \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043d\u043f\u0443\u0442\u0443 \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c &quot;checked&quot; \u0438\u043d\u043f\u0443\u0442\u0430 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c &quot;answer-text&quot;         \/*         =&gt;  &lt;div class=&quot;input-group&quot;&gt;               &lt;div class=&quot;input-group-prepend&quot;&gt;                 &lt;div class=&quot;input-group-text&quot;&gt;               =&gt;  &lt;input type=&quot;radio&quot; checked name=&quot;answer&quot;&gt;                 &lt;\/div&gt;               &lt;\/div&gt;            =&gt; &lt;input class=&quot;form-control answer-text&quot; type=&quot;text&quot; value=&quot;foo&quot; &gt;            ...         *\/         const rightAnswerText = findOne(findParent(findOne(q, 'input:checked'), 3), '.answer-text').value          \/\/ \u0442\u0435\u043a\u0441\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f         const explanationText = findOne(q, '.explanation-text').value          \/\/ \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0444\u043e\u0440\u043c\u0443         isEmpty(questionText, ...answersText, explanationText)                  \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c &quot;\u0438\u043d\u0434\u0435\u043a\u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u0430&quot;         obj[questions.indexOf(q)] = {             question: questionText,             answers: answersText,             rightAnswer: rightAnswerText,             explanation: explanationText         }     })      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     console.table(obj)      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b     const data = new Blob(         [JSON.stringify(obj)], {             type: 'application\/json'         }     )          \/\/ \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d     \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443     if (findOne(C, 'a') !== null) {         findOne(C, 'a').remove()     }          \/\/ \u043f\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u0441\u0445\u0435\u043c\u0435     const link = document.createElement('a')     link.setAttribute('href', URL.createObjectURL(data))     link.setAttribute('download', 'data.json')     link.className = 'btn btn-success'     link.textContent = 'Download data'     C.append(link)     URL.revokeObjectURL(data) } <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 300px; position: relative;\"><iframe src=\"https:\/\/codepen.io\/harryheman\/embed\/preview\/oNbJYya?height=300&amp;slug-hash=oNbJYya&amp;default-tabs=js%2Cresult&amp;host=https%3A%2F%2Fcodepen.io\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen><\/iframe><\/div>\n<\/div>\n<\/div>\n<h5>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/h5>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"javascript\">{     &quot;0&quot;: {         &quot;question&quot;: &quot;first question&quot;,         &quot;answers&quot;: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;],         &quot;rightAnswer&quot;: &quot;foo&quot;,         &quot;explanation&quot;: &quot;first explanation&quot;     },     &quot;1&quot;: {         &quot;question&quot;: &quot;second question&quot;,         &quot;answers&quot;: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;],         &quot;rightAnswer&quot;: &quot;bar&quot;,         &quot;explanation&quot;: &quot;second explanation&quot;     },     &quot;2&quot;: {         &quot;question&quot;: &quot;third question&quot;,         &quot;answers&quot;: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;],         &quot;rightAnswer&quot;: &quot;baz&quot;,         &quot;explanation&quot;: &quot;third explanation&quot;     } } <\/code><\/pre>\n<p>  \u041f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b (data.json) \u0432 \u043f\u0430\u043f\u043a\u0443 \u00abTest-Maker\u00bb.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u00abuseData.html\u00bb \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f: <\/p>\n<pre><code class=\"xml\">&lt;!-- head --&gt; &lt;!-- Bootstrap CSS --&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.0\/css\/bootstrap.min.css&quot;         integrity=&quot;sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk&quot; crossorigin=&quot;anonymous&quot;&gt;  &lt;!-- body --&gt; &lt;h1&gt;Use data&lt;\/h1&gt; <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u043e\u0447\u043a\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439: <\/p>\n<pre><code class=\"css\">body {     max-width: 512px;     margin: 0 auto;     text-align: center; }  section *:not(h3) {     text-align: left; }  input, button {     margin: .4em; }  label, input {     cursor: pointer; }  .right-answer, .explanation {     display: none; } <\/code><\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442: <\/p>\n<pre><code class=\"javascript\">\/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 const getData = async url =&gt; {     const response = await fetch(url)     const data = await response.json()     return data }  \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 getData('data.json')     .then(data =&gt; {         \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c         console.table(data)                  \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430         createTest(data)     })  \/\/ \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 name let name = Date.now() \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430 const createTest = data =&gt; {     \/\/ data - \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432     \/\/ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430     for (const item in data) {         \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c         console.log(data[item])          \/\/ \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442,         \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f         const {             question,             answers,             rightAnswer,             explanation         } = data[item]          \/\/ \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 name \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430         name++          \/\/ \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u043e\u043f\u0440\u043e\u0441\u0430         const questionTemplate = `             &lt;hr&gt;             &lt;section&gt;                 &lt;h3&gt;Question ${item}: ${question}&lt;\/h3&gt;                 &lt;form&gt;                     &lt;legend&gt;Answers&lt;\/legend&gt;                     ${answers.reduce((html, ans) =&gt; html += `&lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;${name}&quot;&gt;${ans}&lt;\/label&gt;&lt;br&gt;`, '')}                 &lt;\/form&gt;                 &lt;p class=&quot;right-answer&quot;&gt;Right answer: ${rightAnswer}&lt;\/p&gt;                 &lt;p class=&quot;explanation&quot;&gt;Explanation: ${explanation}&lt;\/p&gt;             &lt;\/section&gt;         `                  \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043a\u043e\u043d\u0435\u0446 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430         document.body.insertAdjacentHTML('beforeend', questionTemplate)     })      \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u044b     const forms = document.querySelectorAll('form')      \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b     forms.forEach(form =&gt; {         const input = form.querySelector('input')         input.click()     })      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432     \/\/ \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0435\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430     const btn = document.createElement('button')     btn.className = 'btn btn-primary'     btn.textContent = 'Check answers'     document.body.append(btn)      \/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438     btn.addEventListener('click', () =&gt; {         \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432         const answers = []          \/\/ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430         forms.forEach(form =&gt; {             \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e) \u043e\u0442\u0432\u0435\u0442\u0430             const chosenAnswer = form.querySelector('input:checked').parentElement.textContent             \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430             const rightAnswer = form.nextElementSibling.textContent.replace('Right answer: ', '')             \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432\u0430             answers.push([chosenAnswer, rightAnswer])         })          console.log(answers)         \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435         \/\/ \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439         \/*         Array(3)             0: (2) [&quot;foo&quot;, &quot;foo&quot;]             1: (2) [&quot;bar&quot;, &quot;bar&quot;]             2: (2) [&quot;foo&quot;, &quot;baz&quot;]         *\/          \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438         checkAnswers(answers)     })      \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f) \u043e\u0442\u0432\u0435\u0442\u043e\u0432     const checkAnswers = answers =&gt; {         \/\/ \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432         let rightAnswers = 0         let wrongAnswers = 0          \/\/ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432\u0430,         \/\/ \u0433\u0434\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 - \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439) \u043e\u0442\u0432\u0435\u0442,         \/\/ \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 - \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442         for (const answer of answers) {             \/\/ \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442             if (answer[0] === answer[1]) {                 \/\/ \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432                 rightAnswers++             \/\/ \u0438\u043d\u0430\u0447\u0435             } else {                 \/\/ \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432                 wrongAnswers++                  \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441 \u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u043b\u044c\u043d\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u043c                 const wrongSection = forms[answers.indexOf(answer)].parentElement                  \/\/ \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435                 wrongSection.querySelector('.right-answer').style.display = 'block'                 wrongSection.querySelector('.explanation').style.display = 'block'             }         }          \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432         const percent = parseInt(rightAnswers \/ answers.length * 100)          \/\/ \u0441\u0442\u0440\u043e\u043a\u0430-\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442         let result = ''                  \/\/ \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432         \/\/ \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c result \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435         if (percent &gt;= 80) {             result = 'Great job, super genius!'         } else if (percent &gt; 50) {             result = 'Not bad, but you can do it better!'         } else {             result = 'Very bad, try again!'         }          \/\/ \u0448\u0430\u0431\u043b\u043e\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0442\u0435\u0441\u0442\u0430         const resultTemplate = `             &lt;h3&gt;Your result&lt;\/h3&gt;             &lt;p&gt;Right answers: ${rightAnswers}&lt;\/p&gt;             &lt;p&gt;Wrong answers: ${wrongAnswers}&lt;\/p&gt;             &lt;p&gt;Percentage of correct answers: ${percent}&lt;\/p&gt;             &lt;p&gt;${result}&lt;\/p&gt;         `                  \/\/ \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043a\u043e\u043d\u0435\u0446 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430         document.body.insertAdjacentHTML('beforeend', resultTemplate)     } } <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439):<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3i\/mn\/vu\/3imnvueshiu5zfihpfs40e0gm7k.png\"><\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 300px; position: relative;\"><iframe src=\"https:\/\/codepen.io\/harryheman\/embed\/preview\/bGEOBQE?height=300&amp;slug-hash=bGEOBQE&amp;default-tabs=js%2Cresult&amp;host=https%3A%2F%2Fcodepen.io\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen><\/iframe><\/div>\n<\/div>\n<\/div>\n<h3>\u0411\u043e\u043d\u0443\u0441. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 CloudFlare<\/h3>\n<p>  \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <a href=\"https:\/\/www.cloudflare.com\/\" rel=\"nofollow\">cloudflare.com<\/a>, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 Workers \u0441\u043f\u0440\u0430\u0432\u0430, \u0437\u0430\u0442\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u00abCreate a Worker\u00bb.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6h\/nn\/dd\/6hnnddhdbzpaujcp59puybsjdji.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qz\/ye\/ah\/qzyeah2gxsc2ghprx2zqowt8soy.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vf\/er\/rn\/vferrn8lz7ab2bckibj5lcantwy.png\"><\/p>\n<p>  \u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u043d\u0430 \u00abdata\u00bb (\u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e). \u0412 \u043f\u043e\u043b\u0435 &quot;{} Script&quot; \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u00abSave and Deploy\u00bb:<\/p>\n<pre><code class=\"javascript\">\/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 addEventListener('fetch', event =&gt; {     event.respondWith(         new Response(             \/\/ \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435             `{                 &quot;0&quot;: {                     &quot;question&quot;: &quot;first question&quot;,                     &quot;answers&quot;: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;],                     &quot;rightAnswer&quot;: &quot;foo&quot;,                     &quot;explanation&quot;: &quot;first explanation&quot;                 },                 &quot;1&quot;: {                     &quot;question&quot;: &quot;second question&quot;,                     &quot;answers&quot;: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;],                     &quot;rightAnswer&quot;: &quot;bar&quot;,                     &quot;explanation&quot;: &quot;second explanation&quot;                 },                 &quot;2&quot;: {                     &quot;question&quot;: &quot;third question&quot;,                     &quot;answers&quot;: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;],                     &quot;rightAnswer&quot;: &quot;baz&quot;,                     &quot;explanation&quot;: &quot;third explanation&quot;                 }             }`,             {                 status: 200,                 \/\/ \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043d\u0438\u044f CORS                 headers: new Headers({'Access-Control-Allow-Origin': '*'})             })         )     }) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dh\/ma\/tk\/dhmatkivuiyjivbmlgbzajk0yd8.png\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 CloudFlare. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c URL \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u0432\u043c\u0435\u0441\u0442\u043e &#8216;data.json&#8217; \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u00abgetData\u00bb. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: getData(&#8216;https:\/\/data.aio350.workers.dev\/&#8217;).then(&#8230;).<\/p>\n<p>  \u0414\u043b\u0438\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0412\u044b \u043d\u0430\u0448\u043b\u0438 \u0432 \u043d\u0435\u0439 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435. <\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/511742\/\"> https:\/\/habr.com\/ru\/post\/511742\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/511742\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4w\/km\/l0\/4wkml0lzn7fzve0f7nzunyuljka.png\"><\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0434\u0440\u0443\u0437\u044c\u044f! <\/p>\n<p>  \u041c\u043d\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e JavaScript \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u044b\u043c. \u0421\u043a\u043e\u0440\u0435\u0435, \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a Node.js \u0438\u043b\u0438 PHP. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, JavaScript \u0443\u043c\u0435\u0435\u0442 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c (\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c), \u0442\u0430\u043a \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0438\u043f\u044b \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438. <\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0440\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ul>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e \u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 txt \u0438 pdf<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 JSON-\u0444\u0430\u0439\u043b\u043e\u0432<\/li>\n<li>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0432\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b: \u043e\u0434\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b (\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON), \u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0412\u0430\u043c \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043c\u043d\u043e\u0439. <\/p>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/harryheman\/Work-With-Files-in-JavaScript\" rel=\"nofollow\">GitHub<\/a>.  <\/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-307243","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307243","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=307243"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307243\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}