Array(100) produces vacant array. Execution of map function will lead undefined.
We need to use spread operator to use map function successfully.
const arr = [...Array(100)].map((_, i) => i);
Source: Shawn Reisner' blog entry
No comments :
Post a Comment