logo

Mootools Number: times2012-08-27

方法: Number times
Executes the function passed in the specified number of times.\\执行该函数通过指定的次数。

语法:
myNumber.times(fn[, bind]);

参数:
1. fn - (function) The function which should be executed on each iteration of the loop. This function is passed the current iteration's index.\\这个函数应该执行在每次循环迭代时。此函数传递当前迭代的指数。

2. bind - (object, optional) The object to use as 'this' in the function. \\该对象用作“本”的功能。


例子:
(4).times(alert); //Alerts "0", then "1", then "2", then "3".

扫描二维码分享话题