The bug is on line 3 of the code, where i is declared as var. This gives i too wide of a scope and causes the function definitions to interpret it as a dynamic variable instead of resolving it. The solution is to declare it as let, which gives:
function createArrayOfFunctions(y) {
var arr = [];
for(let i = 0; i < y; i++) {
arr[i] = function(x) { return x + i; }
}
return arr;
}