Once removed duplicates, find the length of an array. I'm using the below code but it's returning 0 as the length of the array:
var mydata = ["1", "2", "3", "3", "4", "5", "5", "6", "7", "7", "8", "9", "9"];
var uniqueNames = [];
$(function() {
  $.each(mydata, function(i, el) {
    if ($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
  });
})
console.log(uniqueNames.length);<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>Total length
13
Expected output
9
 
     
     
    