title: How to get domain from email address in Javascript?
body: <p>I want to get the domain part from an email address, in Javascript. It's easy to extract the domain from an email like via <code>split</code>: "joe@example.com", which is <code>example.com</code>.</p>
  
  <p>However, emails also come in forms like "joe@subdomain1.example.com.uk", of which the domain is <code>example.com.uk</code>, instead of <code>subdomain1.example.com.uk</code>. The problem here is that <code>subdomain1</code> can be mistakenly considered as part of the domain.</p>
  
  <p>How do I do this reliably?</p>