modify array with specific condition (JS) : Have an array with objects.
Look like this: [{id:2},{id:3},{id:4},{id:9},{id:10},{id:11},]

in result I want this: [{id:2,id:4},{id:9,id:11}]

Have no idea how to delete middle values, and how to separate it when we don't have ids:5,6,7,8