title: javascript - splitting a string and passing all values to a function
body: <p>The string is </p>
  
  <pre><code>var str = "Beautiful Day";
  </code></pre>
  
  <p>I am splitting the str using white space as the separator</p>
  
  <pre><code>var substr = str.split(" ");
  </code></pre>
  
  <p>The above should return 2 words and so the length of the string should be 2</p>
  
  <pre><code>var strLength = substr.length;
  </code></pre>
  
  <p><strong>Now, I want to pass both the words as separate parameters of a function such that:</strong></p>
  
  <pre><code>myFunction(word1, word2)
  </code></pre>
  
  <p><strong>But I don't want to use</strong> </p>
  
  <pre><code>substr[0]
  substr[1]
  </code></pre>