const createGenerator = function* ( array, ) { let index = 0 while (index < 3) { yield array[index] index = index + 1 } }