How to resolve this " Uncaught TypeError: Cannot convert undefined or null to object "
<p>My function is :</p>

<pre><code>function collect_que_ids(e) {
  var val = e.val();
  var data_lo = e.attr('data-lo');
  new_hash = {};
  new_hash[val] = data_lo;
  if(e.is(':checked')){
    if(checked_box_hash.includes(new_hash)){
      checked_box_hash;
    }else{
      checked_box_hash.push(new_hash);
    }
  }
  else{
    new_hash_key = Object.keys(new_hash)[0]
    new_hash_value = new_hash[new_hash_key]
    $.each(checked_box_hash, function(key, value){
      if (typeof Object.keys(value) !== 'nil') {
        current_key = Object.keys(value)
        if (current_key[0] == new_hash_key &amp;&amp; value[current_key[0]] == new_hash_value) {
          checked_box_hash.splice(key, 1)
        }
      }
    })
  }
};
</code></pre>

<p>I am getting error on this line. </p>

<pre><code>if (typeof Object.keys(value) !== 'nil') {
</code></pre>

<p>Need to resolve it. please help to do.</p>