{"id":276446,"date":"2016-03-18T15:42:02","date_gmt":"2016-03-18T12:42:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=276446"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=276446","title":{"rendered":"i10n \u0441\u0442\u0440\u043e\u043a \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (JavaScript)"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/storage3\/c87\/6d0\/448\/c876d0448bb64129f9a7c102d48a5ef2.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 <b>Tagged Template Literals<\/b>, \u043f\u043e \u0440\u0443\u0441\u0441\u043a\u0438 \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u0437\u044b\u0432\u0430\u044e\u0442 <b>\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/b>.<br \/>  \u0417\u0430 \u0440\u0443\u0431\u0435\u0436\u043e\u043c \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0432 <b>tagged string literals<\/b>, \u0430 <b>Template Literals<\/b> \u0442\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432 <b>interpolated string literals<\/b> \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e <b>interpoliterals <\/b>. \u041e\u0431\u043e\u0436\u0430\u044e js \u0442\u0443\u0441\u043e\u0432\u043a\u0443, \u0433\u0434\u0435 \u0445\u0430\u043b\u0438\u0432\u0430\u0440 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0434\u0430\u0436\u0435 \u0438\u0437 \u0437\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0438\u0447\u0438 \ud83d\ude42<\/p>\n<h2>\u0427\u0442\u043e, \u043a\u0443\u0434\u0430, \u0437\u0430\u0447\u0435\u043c<\/h2>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0442\u043e\u043c\u0443 \u043e \u0447\u0435\u043c \u044f \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u0437 \u0445\u043e\u0434\u044f \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430, \u043f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e <b>Template Literals<\/b>.<br \/>  \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0432\u0430\u0441 \u0438\u0445 \u0443\u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b:  <\/p>\n<pre><code class=\"javascript\">var text = `Now is the time for all good men to come to the aid of their country!`;  console.log( text ); \/\/ Now is the time for all good men \/\/ to come to the aid of their \/\/ country! <\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0438\u0445 \u043a\u0440\u0443\u0442\u043e\u0441\u0442\u044c, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445 \u0438 \u043e\u043d \u0441\u0430\u043c \u0433\u0434\u0435 \u043d\u0430\u0434\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. <br \/>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0432\u0442\u043e\u0440\u0430\u044f \u043a\u0440\u0443\u0442\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0432 \u043b\u0438\u0442\u0435\u0440\u0430\u043b, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0435 \u043b\u0438\u0431\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<br \/>  \u0414\u043e ES6:  <\/p>\n<pre><code class=\"javascript\">var name = &quot;Kyle&quot;;  var greeting = &quot;Hello &quot; + name + &quot;!&quot;;  console.log( greeting );            \/\/ &quot;Hello Kyle!&quot; console.log( typeof greeting );     \/\/ &quot;string&quot; <\/code><\/pre>\n<p>  \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>Template Literals<\/b>:  <\/p>\n<pre><code class=\"javascript\">var name = &quot;Kyle&quot;;  var greeting = `Hello ${name}!`;  console.log( greeting );            \/\/ &quot;Hello Kyle!&quot; console.log( typeof greeting );     \/\/ &quot;string&quot; <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0430\u0434\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u043b\u044c\u0437\u044f. \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u0445\u043e\u0434\u044f\u0442 \u0441\u043f\u043e\u0440\u044b \u043e\u0431 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438. \u041a\u0443\u0434\u0430 \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0430\u0437\u0443\u043c\u043d\u0435\u0439 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u043e\u0432\u043e <i>\u0448\u0430\u0431\u043b\u043e\u043d<\/i>, \u0430 <i>\u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f<\/i>, \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0437\u0430\u0431\u043b\u0443\u0436\u0434\u0435\u043d\u0438\u0435. \u0414\u0430\u043d\u043d\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b \u043f\u043e\u0434\u043e\u0431\u0435\u043d <b>Immediately-Invoked Function Expression (IIFE)<\/b>, \u043e\u043d \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 <i>\u0437\u0430\u043f\u0435\u043a\u0430\u0435\u0442\u0441\u044f<\/i> \u0432 \u0441\u0442\u0440\u043e\u043a\u0443. \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u0442:  <\/p>\n<pre><code class=\"javascript\">function foo(str) {     var name = &quot;foo&quot;;     console.log( str ); \/\/name \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0432 str \u0438 str typeof 'string' }  function bar() {     var name = &quot;bar&quot;;     foo( `Hello from ${name}!` ); }  var name = &quot;global&quot;;  bar();  <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u044f \u043f\u0438\u0441\u0430\u043b \u0432\u044b\u0448\u0435, \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"javascript\">function upper(s) {     return s.toUpperCase(); }  var who = &quot;reader&quot;;  var text = `A very ${upper( &quot;warm&quot; )} welcome to all of you ${upper( `${who}s` )}!`;  console.log( text ); \/\/ A very WARM welcome \/\/ to all of you READERS! <\/code><\/pre>\n<h2>Tagged Template Literals<\/h2>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441 \u0432\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <b>Tagged Template Literals<\/b>:  <\/p>\n<pre><code class=\"javascript\">function foo(strings, ...values) {     console.log( strings );     console.log( values ); }  var desc = &quot;awesome&quot;;  foo`Everything is ${desc}!`; \/\/ [ &quot;Everything is &quot;, &quot;!&quot;] \/\/ [ &quot;awesome&quot; ] <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435<code> tag foo <\/code>, \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u0437 <code>(...)<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>foo<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f <code>${desk}<\/code>, \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. <br \/>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0430\u0445\u0430\u0440\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a:  <\/p>\n<pre><code class=\"javascript\">const greeting = lang`Hello ${ name }!` <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043f\u043e \u043c\u043d\u0435 \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u043d\u0435\u0436\u0435\u043b\u0438 \u2014 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0435\u0441\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:  <\/p>\n<pre><code class=\"javascript\">const  greeting  = `${ lang('Hello') } ${ name }!` <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043d\u043e\u0441\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c:  <\/p>\n<pre><code class=\"javascript\">const greeting  = lang('Hello') + name + '!'; <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438, \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0435\u0435 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c, \u0441 \u044d\u0442\u0438\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 <b>reduce<\/b>:  <\/p>\n<pre><code class=\"javascript\">function lang(strings, ...values) {     return strings.reduce( function(s,v,idx){         return s + (idx &gt; 0 ? values[idx-1] : &quot;&quot;) + v;     }, &quot;&quot; ); } <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u043d\u0438\u043f\u043f\u0435\u0442:  <\/p>\n<pre><code class=\"javascript\">const lang = l = (strings, ...values) =&gt;     strings.reduce((prevString, nextString, index) =&gt;         prevString + (index &gt; 0 ? values[index - 1] : '') + translate(nextString), ''); \/\/\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 translate \u0432 \u0432\u0430\u0448\u0438\u0445 \u0440\u0443\u043a\u0430\u0445 :) <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"javascript\">const name = '\u0414\u043c\u0438\u0442\u0440\u0438\u0439';  console.log( lang`Hello ${ name }, how are you?` )  \/\/\u0418\u043b\u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 console.log( l`Hello ${ name }, how are you?` ) \/\/\u041f\u0440\u0438\u0432\u0435\u0442 \u0414\u043c\u0438\u0442\u0440\u0438\u0439, \u043a\u0430\u043a \u0434\u0435\u043b\u0430? <\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0447\u0438\u0441\u0435\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 US $:  <\/p>\n<pre><code class=\"javascript\">function dollabillsyall(strings, ...values) {     return strings.reduce( function(s,v,idx){         if (idx &gt; 0) {             if (typeof values[idx-1] == &quot;number&quot;) {                 \/\/ look, also using interpolated                 \/\/ string literals!                 s += `$${values[idx-1].toFixed( 2 )}`;             }             else {                 s += values[idx-1];             }         }          return s + v;     }, &quot;&quot; ); }  var amt1 = 11.99,     amt2 = amt1 * 1.08,     name = &quot;Kyle&quot;;  var text = dollabillsyall `Thanks for your purchase, ${name}! Your product cost was ${amt1}, which with tax comes out to ${amt2}.`  console.log( text ); \/\/ Thanks for your purchase, Kyle! Your \/\/ product cost was $11.99, which with tax \/\/ comes out to $12.95. <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u0443 \u043f\u043e\u0441\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u0440\u043e\u043a <b>Tagged Template Literals<\/b> \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0437\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u0442\u0435\u043c\u044b, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \ud83d\ude42<br \/>  \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f:<br \/>  <a href=\"https:\/\/github.com\/getify\/You-Dont-Know-JS\/blob\/master\/es6%20%26%20beyond\/ch2.md\">github.com\/getify\/You-Dont-Know-JS\/blob\/master\/es6%20%26%20beyond\/ch2.md<\/a>               <\/p>\n<div class=\"clear\"><\/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:\/\/habrahabr.ru\/post\/279595\/\"> https:\/\/habrahabr.ru\/post\/279595\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/storage3\/c87\/6d0\/448\/c876d0448bb64129f9a7c102d48a5ef2.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 <b>Tagged Template Literals<\/b>, \u043f\u043e \u0440\u0443\u0441\u0441\u043a\u0438 \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u0437\u044b\u0432\u0430\u044e\u0442 <b>\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/b>.<br \/>  \u0417\u0430 \u0440\u0443\u0431\u0435\u0436\u043e\u043c \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0432 <b>tagged string literals<\/b>, \u0430 <b>Template Literals<\/b> \u0442\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432 <b>interpolated string literals<\/b> \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e <b>interpoliterals <\/b>. \u041e\u0431\u043e\u0436\u0430\u044e js \u0442\u0443\u0441\u043e\u0432\u043a\u0443, \u0433\u0434\u0435 \u0445\u0430\u043b\u0438\u0432\u0430\u0440 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0434\u0430\u0436\u0435 \u0438\u0437 \u0437\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0438\u0447\u0438 \ud83d\ude42<\/p>\n<h2>\u0427\u0442\u043e, \u043a\u0443\u0434\u0430, \u0437\u0430\u0447\u0435\u043c<\/h2>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0442\u043e\u043c\u0443 \u043e \u0447\u0435\u043c \u044f \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u0437 \u0445\u043e\u0434\u044f \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430, \u043f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e <b>Template Literals<\/b>.<br \/>  \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0432\u0430\u0441 \u0438\u0445 \u0443\u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b:  <\/p>\n<pre><code class=\"javascript\">var text = `Now is the time for all good men to come to the aid of their country!`;  console.log( text ); \/\/ Now is the time for all good men \/\/ to come to the aid of their \/\/ country! <\/code><\/pre>\n<p>  <\/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-276446","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276446","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=276446"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276446\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=276446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=276446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=276446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}