Default parameters vs Logical OR vs Nullish Coalescing.
function withDefault(x = 10) { return x; }
function withOr(x) { return x || 10; }
function withNullish(x) { return x ?? 10; }Initializing...
| Test Case | Ops/sec | |
|---|---|---|
| Default param | | ready |
| Logical OR | | ready |
| Nullish Coalescing | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.