const createArrOfFunc = length => { let arr = Array.from( {length}, (val, i) => _ => i ) return arr; } let a = createArrOfFunc(5); alert(a[2]());