title: remove n occurrences of exclamation marks in a string javascript
body: <p>I am wondering if anyone knows how to replace <code>n</code> number of occurrences of exclamation marks in a string. I need to remove <code>n</code> exclamation marks in the sentence from left to right and <code>n</code> is always positive integer.</p>
  
  <p>An example would be as follows:</p>
  
  <pre><code>remove("Hi!!!",1) === "Hi!!"
  remove("!!!Hi !!hi!!! !hi",3) === "Hi !!hi!!! !hi"
  </code></pre>
  
  <p>I have tried many approaches but have had no luck so far. Here is my latest attempt.</p>
  
  <pre><code>function remove(str, n){
     str.replace(/!{n}/g, '');
  }
  </code></pre>