Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function createArray(length, value) {
return Array.apply(null, new Array(length)).map((i, index) => typeof value === 'function' ? value(i, index) : value)
createArray(10, (item, index) => ({ a: index }) )
createArray(10, 'lala')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.