Test name | Executions per second |
---|---|
Array Spread | 14619.4 Ops/sec |
Array Apply | 14936.1 Ops/sec |
function createDateArrayInAMonth(year, month) {
return [new Array(new Date(year, month, 0).getDate())].map((_, i) => new Date(year, month - 1, i + 1).toLocaleString())
}
createDateArrayInAMonth(2023, 10)
function createDateArrayInAMonth(year, month) {
return Array.apply(null, new Array(new Date(year, month, 0).getDate())).map((_, i) => new Date(year, month - 1, i + 1).toLocaleString())
}
createDateArrayInAMonth(2023, 10)