To properly sort an array, you can use [1,2,5,10].sort((a, b) => a — b) Easy solution, provided you knew there was a problem in the first place :) 2. new Date() is just wonderful new Date() can accept: no argument: returns now one argument x: returns 1st of january 1970, + x milliseconds.
Full article