Array.filter

Benchmark created on


Setup

var arrayToFilter = [1, 2, 3, undefined, 4, null, 10, -1, "a"]

Test runner

Ready to run.

Testing in
TestOps/sec
.filter((v) => v)
arrayToFilter.filter((v) => v)
ready
.filter(Boolean)
arrayToFilter.filter(Boolean)
ready

Revisions

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