Trouble with function inside of loop

I’ve tried using a function expression and an immediately invoked function but it is still giving me this warning. I know this is a beginner mistake and deals with closures. I just need some help.

Currently trying to complete the Smallest Common Multiple Algorithm. I’m trying to make a function that tests whether a number is divisible by all the items inside of an array. x in the function is the number that is being checked whether is it divisible by all the items in the array and y is supposed to represent all the items in the array.