You didn’t close function definition for the returned function from fromTo
.
function fromTo(x,y){
return function(){
if(x < y ){
return x++;
}
}
}
function element(arr,fun){
return function(){
return arr[fun()];
}
}