JavaScript 奇淫技巧

介绍一些不常用 但是很有用的js技巧

1. 使用for创建死循环

for(;;){

}

2.使用math.max.apply 取出数组中的最大值

//举例 for example

var arr = [1, 2, 3, 4, 5, "6"];  // 可以输入字符串类型的数字

var maxNum = Math.max.apply(null, arr);

console.log(maxNum);    //返回值为 6

猜你喜欢

转载自www.cnblogs.com/CooLLYP/p/10080024.html