Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36
Chrome 72
Mac OS X 10.14.3
Desktop
6 years ago
Test name Executions per second
Optional Chaining 3759220.2 Ops/sec
Lodash 2044824.0 Ops/sec
Script Preparation code:
AخA
 
var obj = {a: {b: {c: {d: 1}}}}
Tests:
  • Optional Chaining

     
    obj.a == null ? undefined : obj.a.b == null ? undefined : obj.a.b.c == null ? undefined : obj.a.b.c.d
  • Lodash

     
    _.get(obj, "a.b.c.d")