Answers for "javascript map empty array"

0

javascript map empty array

let array1 = Array.from(Array(5), (_, i) => i + 1)
console.log('array1', JSON.stringify(array1)) // 1,2,3,4,5

let array2 = Array.from({length: 5}, (_, i) => (i + 1) * 2)
console.log('array2', JSON.stringify(array2)) // 2,4,6,8,10
Posted by: Guest on July-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language