Date sort comparison

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
reduce
const dateStrings = ["01/01/2021", "01/01/2022", "01/01/2023"]

console.log(dateStrings.reduce((a, b) => (a > b ? a : b)))
ready
Math.max
const dateStrings = ["01/01/2021", "01/01/2022", "01/01/2023"]

const dates = dateStrings.map(dateString => new Date(dateString))

console.log(new Date(Math.max(...dates)))
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.