In ES6 using Array from() and keys() methods.
(在ES6中,使用Array from()和keys()方法。)
Array.from(Array(10).keys())
//=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Shorter version using spread operator .
(使用传播算子的较短版本。)
[...Array(10).keys()]
//=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…