<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # arguments 函數在運行時,會在函數體內定義一個arguments變量,其內容是調用該函數時傳入的參數。 ~~~ var func = function () { console.dir(arguments); }; func();//[] func(10);//[10] func(10, "ES", true);//[10,"ES",true] ~~~ # call和apply ES中的函數是以對象的形式存在的。 ~~~ var func = function () { }; console.dir(func); ~~~ ![](https://box.kancloud.cn/03461b68aa03dafddc3d532207fc1180_208x128.jpg) Function類對象有兩個常用的成員函數,call和apply,用于“顯式”調用函數。 他們行為是一樣的,但是在使用上存在著差別。 ~~~ var func = function () { console.dir(this); console.dir(arguments); }; var foo = { foo: 'I am foo' }; //call(thisRef,...[argus]); func.call(foo, 1, 2, 3); console.log('---------'); //apply(thisRef,[argus]) func.apply(foo, [1, 2, 3]); ~~~ ![](https://box.kancloud.cn/04c379f9ab95eb2f5d8f94f3f7a45568_213x162.jpg) 與一般情況下使用函數時的“隱式”調用結果一樣。 ~~~ foo.func = func; foo.func(1, 2, 3); ~~~ ![](https://box.kancloud.cn/122f843f4d4f724d5dedb89c09e00491_419x199.jpg) 因此,把函數的調用看作是call或apply函數的使用,this幾乎和一般的參數一樣。 這樣一來,this的綁定行為就不會顯得很特別。 # this與裝箱 ~~~ var func = function () { console.dir(this); }; func.call(2017);//Number類對象 Number.prototype.func = func; var num = 2017; num.func();//Number類對象 ~~~ 原始值作為this的綁定傳入函數前,會進行一次裝箱,將新構造的對象與this關鍵字進行綁定。 一如前文所述,this關鍵字的作用是獲取調用函數的對象。
                  <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>

                              哎呀哎呀视频在线观看