The elements in the js array are date strings. How can they be duplicated and sorted? Solve

var array = ["2018-03-05, 2013-06-12, 2019-03-12, 2018-03-05, 2014-02-22];
wants to de-weight and sort the previous array

Apr.07,2021

var arr = ['2018-03-05','2013-06-12','2019-03-12','2018-03-05','2014-02-22'];
var arr1 = [...new Set(arr)]
var sortedarr = arr1.sort((a,b)=>{
                return a>b
             }) 
console.log(sortedarr)



var times = {}
array.forEach(function(item) {
    var time = new Date(item).getTime()
    if (!times[time]) {
        times[time] = true
    }

})

var arrTimes = Object.keys(times).sort(function(a, b){return a - b })

and then you just reformat it


MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e505b5-43d61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e505b5-43d61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?