checking for key
Date tested:
10 months ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 OPR/89.0.4447.64 (Edition GX-CN)
Test name
Executions per second
js in
203717.0 Ops/sec
js property
200529.0 Ops/sec
ramda has
171193.5 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.26.1/ramda.min.js"></script>
Script Preparation code:
var test = { hi: null, hello: undefined, goodbye: 1, }
Tests:
js in
if ('hi' in test) console.log('yes')
js property
if (test.hasOwnProperty('hi')) console.log('yes')
ramda has
if (R.has('hi', test)) console.log('yes')
Open this result on MeasureThat.net