function comparing 2 arrays