执行传递的函数指定的次数
语法:
myNumber.times(fn[, bind]);
参数:
- fn - (function) 每次循环执行的函数。返个函数传递当前的索引为参数。
- bind - (object, optional) 在函数中用做this的对象。
举例:
(4).times(alert); // 弹出 "0", 然后弹出 "1", 然后 "2", 然后 "3".
数字方法: toFloat
返回一个浮点数。 必须工作在字符串和数字上。
语法:
myNumber.toFloat();
返回值:
- (number) 浮点数.
举例:
(111).toFloat(); // 返回 111 (111.1).toFloat(); // 返回 111.1