So, I was going through this [article](https://css-tricks.com/dangers-stopping-event-propagation/) about the danger when using Stopping Event Propagation. There in the section where it is described what else to do instead of using `stopPropagation`, this code is shown:

```
$(document).on('click', function(event) {
  if (!$(event.target).closest('#menucontainer').length) {
    // Hide the menus.
  }
});

```

What I didn't get here is why the `length` property is used in the statement? Isn't the `closest` enough to determine whether the clicked element is the event target?