<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國際加速解決方案。 廣告
                ## 問題 Problem 你想調用一個無參數的函數,但是你不想使用括號。 You want to call a function that takes no arguments, but don’t want to use parentheses. ## 方法 Solution 不管怎樣,都是用括號。 Use parentheses anyway. 另外一種方案:利用do標記法,例如: Another alternative is to utilize the do-notation like so: ~~~ notify = -> alert "Hello, user!" do notify if condition ~~~ 編譯成JavaScript如下: This compiles to the following JavaScript: ~~~ var notify; notify = function() { return alert("Hello, user!"); }; if (condition) { notify(); } ~~~ ## 討論 Discussion 和Ruby一樣,CoffeeScript允許你在調用方法時不使用括號。然后,CoffeeScript會把純粹的函數名當作指向這個函數的指針。這樣實際會導致這樣的結果——你沒有給方法傳遞函數,CoffeeScript就無法分辨出你想調用這個函數還是把它當作一個引用使用。 Like Ruby, CoffeeScript allows you to drop parentheses to method calls. Unlike Ruby, however, CoffeeScript treats a bare function name as the pointer to the function. The practical upshot of this is that if you give no arguments to a method, CoffeeScript cannot tell if you want to call the function or use it as a reference. 誰優誰劣?我這并沒有好壞之分,就只是不一樣。這產生了一個與預期不一樣的語法特例——括號不_總是_可選的——但是作為回報,它給予了使用名字平凡傳遞或者接受一個函數的能力,這樣看Ruby就有點不給力了。 Is this good or bad? It’s just different. It creates an unexpected syntax case – parentheses aren’t?_always_?optional – but in exchange it gives you the ability to pass and receive functions fluently by name, something that’s a bit klunky in Ruby. 這種do記法對于那些使用CoffeeScript但有括號恐懼癥的人來說是一種優雅的方式。盡管如此,有些人還是喜歡在調用函數時把括號寫上。 This usage of the do-notation is a neat approach for CoffeeScript with parenphobia. Some people simply prefer to write out the parentheses in the function call, though.
                  <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>

                              哎呀哎呀视频在线观看