Filter the array by taking the higher points (max y value) and only. Keep one per slot. There are 2 different slots, the smallest one will have the new property close to true
close
array of all the points
options.
copy of points with 'close' property.
Filter the array by taking the higher points (max y value) and only. Keep one per slot. There are 2 different slots, the smallest one will have the new property
closeto true