null check vs implicit cast (v2)

Revision 2 of this benchmark created on


Setup

const foo = 'lorem'

Test runner

Ready to run.

Testing in
TestOps/sec
!= null
if (foo != null) {
	console.log('ok')
}
ready
!
if (!foo) {
	console.log('ok')
}
ready
!== null || !== undefined
if (foo !== null || foo !== undefined) {
	console.log('ok')
}
ready
!== undefined || !== null
if (foo !== undefined || foo !== null) {
	console.log('ok')
}
ready

Revisions

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