{"id":249751,"date":"2015-02-05T03:03:06","date_gmt":"2015-02-04T23:03:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=249751"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=249751","title":{"rendered":"<span class=\"post_title\">\u041c\u0435\u043d\u044f\u0435\u043c CoffeeScript \u043d\u0430 ES6<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t<i>\u0421\u043f\u0435\u0448\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u0441\u043b\u044b\u0448\u0430\u043d\u044b \u043e ES6 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443\u0441\u043f\u0435\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0451. \u0422\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0438\u0447\u0430\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u0430\u044f <a href=\"https:\/\/twitter.com\/BlakeWilliams__\">\u0411\u043b\u0435\u0439\u043a\u043e\u043c \u0423\u0438\u043b\u044c\u044f\u043c\u0441\u043e\u043c<\/a> \u0432 \u0431\u043b\u043e\u0433\u0435 Thoughtbots. \u042f \u0436\u0435, \u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0430, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434.<\/i><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"http:\/\/en.wikipedia.org\/wiki\/ECMAScript#ECMAScript_Harmony_.286th_Edition.29\">ES6<\/a>, \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f JavaScript, \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0417\u0430 \u043d\u0435\u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043e\u043d\u0430 \u0440\u0435\u0448\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c CoffeeScript, \u043d\u043e \u0431\u0435\u0437 \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430.<\/p>\n<h2>ES6 \u0441\u0435\u0433\u043e\u0434\u043d\u044f<\/h2>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 ES6 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0442\u043e\u0440 \u0432 ES5 <a href=\"https:\/\/6to5.org\/\">6to5<\/a>. 6to5 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438, \u0432 \u0438\u0445 \u0447\u0438\u0441\u043b\u0435: Broccoli, Grunt, Gulp \u0438 Sprockets. \u0423 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0441\u043e <a href=\"https:\/\/github.com\/josh\/sprockets-es6\">sprockets-es6<\/a>, \u0430 4.x Sprockets \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c 6to5 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c ES6 \u043f\u0440\u044f\u043c\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0432 <a href=\"https:\/\/6to5.org\/repl\/\">6to5 REPL<\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c Vim<\/b><\/p>\n<div class=\"spoiler_text\">\u0427\u0442\u043e\u0431\u044b \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c *.es6 \u0444\u0430\u0439\u043b\u044b \u0441 JavaScript, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u0441\u0432\u043e\u0439 .vimrc \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443:  <\/p>\n<pre><code>autocmd BufRead,BufNewFile *.es6 setfiletype javascript <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h2>\u041a\u043b\u0430\u0441\u0441\u044b<\/h2>\n<p>  \u0412 ES6, \u043a\u0430\u043a \u0438 \u0432 Coffee, \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043b\u0430\u0441\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Coffee \u0438 \u043d\u0430 ES6.<\/p>\n<p>  CoffeeScript \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043a\u0430\u043a \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u0435\u0437 \u0441\u043a\u043e\u0431\u043e\u043a:  <\/p>\n<pre><code class=\"coffeescript\">class Person   constructor: (@firstName, @lastName) -&gt;    name: -&gt;     &quot;#{@first_name} #{@last_name}&quot;    setName: (name) -&gt;     names = name.split &quot; &quot;      @firstName = names[0]     @lastName = names[1]  blake = new Person &quot;Blake&quot;, &quot;Williams&quot; blake.setName(&quot;Blake Anderson&quot;) console.log blake.name() <\/code><\/pre>\n<p>  \u0412 ES6 \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b:  <\/p>\n<pre><code class=\"javascript\">class Person {   constructor(firstName, lastName) {     this.firstName = firstName;     this.lastName = lastName;   }    get name() {     return this.firstName + &quot; &quot; + this.lastName;   }    set name(name) {     var names = name.split(&quot; &quot;);      this.firstName = names[0];     this.lastName = names[1];   } }  var blake = new Person(&quot;Blake&quot;, &quot;Williams&quot;); blake.name = &quot;Blake Anderson&quot; console.log(blake.name); <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u0442\u0435\u043a\u0430\u043c\u0438 \u0438\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u043c\u0438 JavaScript \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, \u0432\u044b \u0443\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 ES6 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f:  <\/p>\n<ul>\n<li>\u041d\u0435\u0442 \u0442\u043e\u0447\u043a\u0438 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/li>\n<li>\u041d\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <i>function<\/i><\/li>\n<li>\u041d\u0435\u0442 \u0437\u0430\u043f\u044f\u0442\u044b\u0445 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/li>\n<\/ul>\n<p>  \u041f\u043b\u044e\u0441 \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <i>name<\/i> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430.<\/p>\n<h2>\u0418\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f<\/h2>\n<p>  \u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u0445\u043e\u0442\u0435\u043b \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441 \u0441\u0442\u0440\u043e\u043a \u0432 JavaScript. \u041a \u0441\u0447\u0430\u0442\u0441\u0442\u044c\u044e ES6 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442, \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/template_strings\">\u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441\u0442\u0440\u043e\u043a<\/a>. \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0438 Coffee \u0438 JS \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u0441\u0442\u0440\u043e\u043a ES6.<\/p>\n<p>  CoffeScript:  <\/p>\n<pre><code class=\"coffeescript\">&quot;CoffeeScript allows multi-line strings with interpolation like 1 + 1 = #{1 + 1} &quot; <\/code><\/pre>\n<p>  JavaScript:  <\/p>\n<pre><code class=\"javascript\">&quot;JavaScript strings can only span a single line &quot; +   &quot;and interpolation isn't possible&quot; <\/code><\/pre>\n<p>  ES6:  <\/p>\n<pre><code class=\"javascript\">`Template strings allow strings to span multiple lines and allow interpolation like 1 + 1 = ${1 + 1} ` <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u0441\u0442\u0440\u043e\u043a \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u0433\u0435\u0442\u0442\u0435\u0440 <i>name<\/i> \u043d\u0430:  <\/p>\n<pre><code class=\"javascript\">get name() {   return `${this.firstName} ${this.lastName}`; } <\/code><\/pre>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438 \u043e\u0442 \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0447\u0438\u0449\u0435.<\/p>\n<h2>\u0422\u043e\u043b\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438<\/h2>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0444\u0438\u0447\u0430, \u0434\u0435\u043b\u0430\u044e\u0449\u0430\u044f Coffee \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u2014 \u0442\u043e\u043b\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u2014 \u0435\u0441\u0442\u044c \u0432 ES6. \u0422\u043e\u043b\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0431\u0430\u0439\u043d\u0434\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a <i>this<\/i>. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043c\u044b \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0431\u0435\u0437 \u0442\u043e\u043b\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u0435\u043b\u043e\u043a.<\/p>\n<p>  \u0412 ES5 \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <i>this<\/i> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"javascript\">var self = this;  $(&quot;buttob&quot;).on(&quot;click&quot;, function() {   \/\/ do something with self }); <\/code><\/pre>\n<p>  Coffee \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u043a\u043e\u0431\u043e\u043a \u0432\u043e\u0432\u0441\u0435:  <\/p>\n<pre><code class=\"coffeescript\">$(&quot;button&quot;).on &quot;click&quot;, =&gt;   # do something with this }); <\/code><\/pre>\n<p>  \u0412 ES6 \u0441\u043a\u043e\u0431\u043a\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:  <\/p>\n<pre><code class=\"javascript\">$(&quot;button&quot;).on(&quot;click&quot;, () =&gt; {   \/\/ do something with this }); <\/code><\/pre>\n<h2>\u0414\u0440\u0443\u0433\u0438\u0435 \u0444\u0438\u0447\u0438<\/h2>\n<p>  \u0412 ES6 \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c.<\/p>\n<h3>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/h3>\n<p>  CoffeeScript:  <\/p>\n<pre><code class=\"coffeescript\">hello = (name = &quot;guest&quot;) -&gt;   alert(name) <\/code><\/pre>\n<p>  ES6:  <\/p>\n<pre><code class=\"javascript\">var hello = function(name = &quot;guest&quot;) {   alert(name); } <\/code><\/pre>\n<p>  <\/p>\n<h3>Splats<\/h3>\n<p>  <a href=\"http:\/\/en.wikipedia.org\/wiki\/Variadic_function\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438 Variadic<\/a>, \u201csplats\u201d \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 Coffee, \u043f\u043e\u0437\u0432\u043e\u043b\u044e\u0449\u0438\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c N \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d. \u0412 ES6 \u043e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u201c\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b\u201d.<br \/>  CoffeeScript:  <\/p>\n<pre><code class=\"coffeescript\">awards = (first, second, others...) -&gt;   gold = first   silver = second   honorable_mention = others <\/code><\/pre>\n<p>  ES6:  <\/p>\n<pre><code class=\"javascript\">var awards = function(first, second, ...others) {   var gold = first;   var silver = second;   var honorableMention = others; } <\/code><\/pre>\n<h3>\u0414\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>  \u0414\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>  CoffeeScript:  <\/p>\n<pre><code class=\"coffeescript\">[first, _, last] = [1, 2, 3] <\/code><\/pre>\n<p>  ES6:  <\/p>\n<pre><code class=\"javascript\">var [first, , last] = [1, 2, 3] <\/code><\/pre>\n<p>  \u0414\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0435\u0442\u0442\u0435\u0440\u0430\u0445, \u043a\u0430\u043a \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u043c <i>name<\/i>, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u043c:  <\/p>\n<pre><code class=\"javascript\">set name(name) {   [this.firstName, this.lastName] = name.split(&quot; &quot;); } <\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0442\u043e\u0440\u044b ES6 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u044e\u0442\u0441\u044f \u043a CoffeScript \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043b\u0438\u0448\u044c \u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 ES6 \u0434\u0430\u0435\u0442 JavaScript. \u0423\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/6to5.org\/docs\/learn-es6\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 ES6 \u0432 \u0441\u0432\u043e\u0451\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435!<\/p>\n<p>  <a href=\"http:\/\/robots.thoughtbot.com\/replace-coffeescript-with-es6\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a> \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/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=\"http:\/\/habrahabr.ru\/post\/249751\/\"> http:\/\/habrahabr.ru\/post\/249751\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t<i>\u0421\u043f\u0435\u0448\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u0441\u043b\u044b\u0448\u0430\u043d\u044b \u043e ES6 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443\u0441\u043f\u0435\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0451. \u0422\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0438\u0447\u0430\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u0430\u044f <a href=\"https:\/\/twitter.com\/BlakeWilliams__\">\u0411\u043b\u0435\u0439\u043a\u043e\u043c \u0423\u0438\u043b\u044c\u044f\u043c\u0441\u043e\u043c<\/a> \u0432 \u0431\u043b\u043e\u0433\u0435 Thoughtbots. \u042f \u0436\u0435, \u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0430, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434.<\/i><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"http:\/\/en.wikipedia.org\/wiki\/ECMAScript#ECMAScript_Harmony_.286th_Edition.29\">ES6<\/a>, \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f JavaScript, \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0417\u0430 \u043d\u0435\u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043e\u043d\u0430 \u0440\u0435\u0448\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c CoffeeScript, \u043d\u043e \u0431\u0435\u0437 \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430.<\/p>\n<h2>ES6 \u0441\u0435\u0433\u043e\u0434\u043d\u044f<\/h2>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 ES6 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0442\u043e\u0440 \u0432 ES5 <a href=\"https:\/\/6to5.org\/\">6to5<\/a>. 6to5 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438, \u0432 \u0438\u0445 \u0447\u0438\u0441\u043b\u0435: Broccoli, Grunt, Gulp \u0438 Sprockets. \u0423 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0441\u043e <a href=\"https:\/\/github.com\/josh\/sprockets-es6\">sprockets-es6<\/a>, \u0430 4.x Sprockets \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c 6to5 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c ES6 \u043f\u0440\u044f\u043c\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0432 <a href=\"https:\/\/6to5.org\/repl\/\">6to5 REPL<\/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-249751","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/249751","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=249751"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/249751\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=249751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=249751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=249751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}