DEV Community

Discussion on: 😰 Optional chaining trap !

Collapse
 
thekashey profile image
Anton Korzunov
  1. JS engine would try to optimize code locations(functions) which are often used.
  2. Feeding different data structures into the same function would eventually cause its deoptimization, and that would make it very slow.
Collapse
 
woubuc profile image
Wouter

I know the Javascript engine can do a lot, but I find it hard to believe that it could optimise a while-loop with object assignments (like the lodash.get function) to be as performant as foo === null checks.