Falsy vs !== undefined

Benchmark created on


Setup

const initialValue = "yay";
const undefValue = undefined;

Test runner

Ready to run.

Testing in
TestOps/sec
falsy
if (initialValue) {
  console.log("yay");
}
if (undefValue) {
  console.log("yay");
}
ready
!== undefined
if (initialValue !== undefined) {
	console.log("yay");
}
if (undefValue !== undefined) {
	console.log("yay");
}
ready

Revisions

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