As a hint: remember that in order to iterate through the actual numbers, you need to use two for loops. You are working with a 2D array.
Also instead of results[i] use results.push(temp), it will be less confusing.
But if you want to continue that way, then use arr[i] not arr[0] because you want to check every array. And you are getting that error because of the condition in your for loop. Set it to i<arr.length instead.