Clique em qualquer lugar e div oculto javascript

document.addEventListener('mouseup', function(e) {
  let container = document.getElementById('container');
  if (!container.contains(e.target)) {
    container.style.display = 'none';
  }
});
web-noob master