Currently, I am facing a challenge with sorting out an array and identifying duplicate values. My goal is to pinpoint the occurrences of a specific value, like a date, within the array. Most of my search results have focused on deleting duplicates, but I simply want to extract the duplicated value itself.
So far, I have made some progress:
var duplicateBookings = [];
$.each(bookedDatesDone, function(i, el){
if($.inArray(el, duplicateBookings) > -1) duplicateBookings.push(el);
});
Unfortunately, this code generates a new array that lacks any duplicate entries. How can I modify this to achieve my desired result?