<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # [Arrow functions](https://babeljs.cn/docs/plugins/transform-es2015-arrow-functions) 就是我們平常說的箭頭函數,可以使用 `babel-plugin-ransform-es2015-arrow-functions` 進行語法轉換。 ``` npm install --save-dev babel-plugin-transform-es2015-arrow-functions ``` ## .babelrc 配置 ```json { "plugins": ["transform-es2015-arrow-functions"] } ``` ## 使用 ### 空箭頭函數 in ```js var a = () => {}; ``` out ```js var a = function a() {}; ``` ### 返回值 in ```js var a = (b) => b; ``` out ```js var a = function a(b) { return b; }; ``` ### 循環中使用 in ```js const double = [1,2,3].map((num) => num * 2); ``` out ```js var double = [1, 2, 3].map(function (num) { return num * 2; }); ``` ### 構造函數中 普通的構造函數長這樣: ```js function A() { this.a = 'a'; this.fun = function () { setTimeout(function () { console.log(this.a); }, 1000); }; } var a = new A(); a.fun(); // undefined ``` 使用箭頭函數后: in ```js function A() { this.a = 'a' this.fun = function () { setTimeout(() => { console.log(this.a); }, 1000) } } let a = new A() a.fun() // a ``` out ```js function A() { this.a = 'a'; this.fun = function () { var _this = this; setTimeout(function () { console.log(_this.a); }, 1000); }; } var a = new A(); a.fun(); // a ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看