📅  最后修改于: 2022-03-11 15:01:39.107000             🧑  作者: Mango
//Using spread operator (...) and keys method
[ ...Array(N).keys() ].map( i => i+1);
//Fill/Map
Array(N).fill().map((_, i) => i+1);
//Array.from
Array.from(Array(N), (_, i) => i+1)
//Array.from and { length: N } hack
Array.from({ length: N }, (_, i) => i+1)