javascript find first instance in array