Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Mac OS X 10.15.5
Desktop
4 years ago
Test name Executions per second
Lodash 2154678.8 Ops/sec
Javascript Object 13637568.0 Ops/sec
Plain Javascript 15890761.0 Ops/sec
HTML Preparation code:
AخA
 
1
<script>https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.core.js</script>
Script Preparation code:
 
var obj = {
    a:{
        b:{
            c:{
                d:{
                    e: 20
                }
            }
        }
    }
};
Tests:
  • Lodash

     
    _.has(obj, 'a.b.c.d.e');
  • Javascript Object

     
    obj.a.b.c.d.hasOwnProperty('e')
  • Plain Javascript

     
    !!((((obj.a || ob).b || ob).c || ob).d).e;