filling in (…rest) parameters with an array?

后端 未结 2 579
死守一世寂寞
死守一世寂寞 2021-01-12 01:05

Some as3 functions handle overloading by allowing for an arbitrary number of parameters using the convention:

public function doSomething( ... rest ):void;
<         


        
相关标签:
2条回答
  • 2021-01-12 01:15

    Check out Function#Apply(). It lets you pass the parameters as an array.

    doSomething.apply(contextObj, args);
    
    0 讨论(0)
  • 2021-01-12 01:26

    Here is a very good tip to pass the rest parameter between functions.

    0 讨论(0)
提交回复
热议问题