map calls a provided callback function once for each element in an array, in order, and constructs a new array from the results. callback is invoked only for indexes of the array which have assigned values, including undefined. It is not called for missing elements of the array (that is, indexes that have never been set, which have been deleted or which have never been assigned a value).
【 在 zswolf2000 (少年壮志不言愁) 的大作中提到: 】
: Array(5).map((x,i)=>i); //[ , , , , ]
: Array(5).fill().map((x,i)=>i); //[ 0, 1, 2, 3, 4 ]
: 为什么这两句结果不同呢?
--
FROM 14.152.90.*