title: Performance about replace() or substr() in Javascript
body: <p>I was wondering about Javascript performance about using string.replace() or string.substr(). Let me explain what I'm doing.</p>
  
  <p>I've a string like</p>
  
  <pre><code>str = "a.aa.a.aa."
  </code></pre>
  
  <p>I just have to "pop" last element in str where I always know what type of character it is (e.g, it's a dot here).</p>
  
  <p>It's so simple, I can follow a lot of ways, like</p>
  
  <pre><code>str = str.substr(0, str.length-1) // same as using slice()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>str = str.replace(/\.$/, '')
  </code></pre>
  
  <p>Which methods would you use? Why? Is there some lack in performance using this or that method? Length of the string is negligible.</p>
  
  <p>(this is my first post, so if I'm doing something wrong please, notify me!)</p>