Variable vs Function

Benchmark created on


Setup

window.__IS_HAPPO_RUN = true
const isHappoRun = () => {
  return !!(window.__IS_HAPPO_RUN && window.document)
}

Test runner

Ready to run.

Testing in
TestOps/sec
Using variable
console.log(window.__IS_HAPPO_RUN)
ready
Using function
console.log(isHappoRun())
ready

Revisions

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