samedi 22 août 2020

Generate random date but exclude some dates from array in javascript

I have an array called dates which contains some dates. I want to exclude those dates and generate a new random date which starts from today.

dates = [20/2/2020,10/2/2019] //dates needs to be excluded

So far I have tried,

        var new_dif =  Math.random(); //generates random number
        
        var daea = new Date(new_dif); //new random date
        
        alert(daea); //generates new date with year 1970



Aucun commentaire:

Enregistrer un commentaire