title: How to get part of a string with delimitters in Javascript
body: <p>This may be the very basic question for all your guys. But, I have already tried for more than 2 hour researching here but didn't find the perfect solution.</p>
  
  <p>I have a string in the format</p>
  
  <pre><code>var x = "A:B:C:D:E";
  </code></pre>
  
  <p>and I want to extract only till C, or let's say by using ":" delimitter, how can we extract only certain part of string? I have tried various JS function but didn't work out? Could please someone help here.</p>
  
  <p>Edit: Thanks you guys. Found the solution for my problem. Below is the code that I used from one of the comments.</p>
  
  <pre><code>var x = "A:B:C:D:E";
  var  output=x.split(':').slice(0,3).join(':');
  </code></pre>