const maxDate = (...dates) => new Date(Math.max.apply(null, ...dates)); const array = [ new Date(2022, 1, 15), new Date(2021, 8, 5), new Date(2022, 8, 22), new Date(2019, 3, 31) ]; maxDate(array); // 2022-08-22T00:00:00.000Z
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter