title: How to parse a string in JavaScript?
body: <p>I'm just curious how I go about splitting a variable into a few other variables.</p>
  
  <p>For example, say I have the following JavaScript:</p>
  
  <pre><code>var coolVar = '123-abc-itchy-knee';
  </code></pre>
  
  <p>And I wanted to split that into 4 variables, how does one do that?</p>
  
  <p>To wind up with an array where</p>
  
  <pre><code>array[0] == 123
  and
  array[1] == abc
  </code></pre>
  
  <p>etc would be cool.</p>
  
  <p>Or (a variable for each part of the string)</p>
  
  <pre><code>var1 == 123  
  and 
  var2 == abc 
  </code></pre>
  
  <p>Could work... either way. How do you split a JavaScript string? </p>