Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Boolean constructor vs double negotiation trick in javascript 3
(version: 0)
Comparing performance of:
Boolean vs double neg with booleans vs Short case
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var bFalse = false; var sEmpty = ''; var sFilled = 'Foo'; var nZero = 0; var nOne = 1;
Tests:
Boolean
Boolean(bFalse) Boolean(sEmpty) Boolean(sFilled) Boolean(nZero) Boolean(nOne)
double neg with booleans
!Boolean(bFalse) !Boolean(sEmpty) !Boolean(sFilled) !Boolean(nZero) !Boolean(nOne)
Short case
Boolean(bFalse)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Boolean
double neg with booleans
Short case
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'd be happy to help explain the provided benchmark! **What is being tested?** MeasureThat.net is testing two different approaches for creating Boolean values in JavaScript: 1. **Boolean constructor**: Creating a new Boolean value using the `Boolean()` function, e.g., `Boolean(bFalse)`. 2. **Double negation trick**: Using double negation to create a Boolean value, e.g., `!Boolean(bFalse)`. The benchmark is testing these two approaches with different inputs: * Empty strings (`sEmpty`) * Non-empty strings (`sFilled = 'Foo'`) * Numbers (0 and 1) **Options compared** The two options being compared are: * Option 1: Using the Boolean constructor (`Boolean()` function) * Option 2: Double negation trick (`!` operator followed by `Boolean()`)
Related benchmarks:
Boolean constructor vs double negotiation trick in javascript
Boolean constructor vs double negotiation trick in javascript - with added single negation test
Boolean constructor vs double negotiation trick in javascript 2
Boolean constructor vs double negotiation trick in javascript but better
Comments
Confirm delete:
Do you really want to delete benchmark?