javascript map empty array

Solutions on MaxInterview for javascript map empty array by the best coders in the world

showing results for - "javascript map empty array"
Anthony
23 Jul 2019
1let array1 = Array.from(Array(5), (_, i) => i + 1)
2console.log('array1', JSON.stringify(array1)) // 1,2,3,4,5
3
4let array2 = Array.from({length: 5}, (_, i) => (i + 1) * 2)
5console.log('array2', JSON.stringify(array2)) // 2,4,6,8,10