gsub a string in javascript
<p>I try to get only the domain name i.e. <code>google.com</code> from javascript</p>

<pre><code>document.location.hostname
</code></pre>

<p>This code returns <code>www.google.com</code>. </p>

<p>How can I only get <code>google.com</code>? In this case it would be to either remove the <code>www.</code> or get only the domain name (if there's such a method in javascript).  </p>
