isNaN - date vs date.valueOf (v4)

Revision 4 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
with valueOf
const date = new Date();
isNaN(date?.valueOf());
ready
just date
const date = new Date();
isNaN(date);
ready
just wrong date
const date = new Date("hihi");
isNaN(date);
ready
wrong date with valueOf
const date = new Date("haha");
isNaN(date?.valueOf());
ready
ternary
const date = new Date();
date? isNaN(date.valueOf()) : false
ready
ternary string
const date = new Date("huhu");
date? isNaN(date.valueOf()) : false
ready

Revisions

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