const vs function

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
const
  const isUnavailable = false
  const unavailableClassName = isUnavailable
    ? '[&>*]:tw-pointer-events-none [&>*]:tw-opacity-40 tw-pointer-events-none tw-opacity-60'
    : ''
ready
function
function getUnavailableClassName() {
    if (!isUnavailable) return ''
    return '[&>*]:tw-pointer-events-none [&>*]:tw-opacity-40 tw-pointer-events-none tw-opacity-60'
  }
ready

Revisions

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