simple count function, availing of higher order forEachIn function from eloquent javascript, after the Object.keys route ran dry