Repeating a function to remove a Key in an object .forEach()

What am I missing here?


function countTheObjects (x)
{
  var item1 = 0;
  function addToObjects(value)
  {
 
    if( typeof value === 'object' )
    {
      item1++
     } 
 
  }
  x.forEach(addToObjects)
  return item1
}

image