title: endsWith in JavaScript
body: <p>How can I check if a string ends with a particular character in JavaScript?</p>
  
  <p>Example: I have a string </p>
  
  <pre><code>var str = "mystring#";
  </code></pre>
  
  <p>I want to know if that string is ending with <code>#</code>. How can I check it?</p>
  
  <ol>
  <li><p>Is there a <code>endsWith()</code> method in JavaScript?</p></li>
  <li><p>One solution I have is take the length of the string and get the last character and check it.</p></li>
  </ol>
  
  <p>Is this the best way or there is any other way?</p>