filling in (…rest) parameters with an array?

后端 未结 2 590
死守一世寂寞
死守一世寂寞 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);
    

提交回复
热议问题