Created
June 1, 2014 08:51
-
-
Save youxiachai/00659d1dd3fe557fcd61 to your computer and use it in GitHub Desktop.
不用循环构建任意初始值数组
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = Array.apply(null, {length : 10}).map(function () { | |
return 'a' | |
}) | |
var b = new Array(10).join(',').split(',').map(function(){return 'b'}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
就效率而言..还是用循环最好....以上两个方法,相比循环在性能上差了一个数量级...果然..好玩的代码..效率都不行..