Optional Chaining vs. Non-optional Chaining (v2)

Revision 2 of this benchmark created on


Description

Optional chaining performance vs. && operators at every level

Test runner

Ready to run.

Testing in
TestOps/sec
Using Optional Chaining
let trackingNumbers = ['hi'];

if(trackingNumbers?.[0] === 'hi') {
console.log("YAY");	
}
ready
&& Operators at Each Level
let trackingNumbers = ['hi'];

if(trackingNumbers.length && trackingNumbers[0] === 'hi') {
console.log("YAY");	
}
ready

Revisions

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