how to get array of sentences and words passing as parameter to a function in javascript?
<p>I have a function say </p>

<pre><code> var init = function(data){
     all sentences: " I have to get all the sentences and return an array containing all sentences"
     all words : "this method should return an array of words in ‘Data’ when there is no parameter passed in. Optionally, when there is a parameter passed in that is a number, return the words in the sentence indicated by the input parameter"

     all reverse sentences: "this method is the same as all Sentences, except it should return the sentences in reverse order"

     reverse words :" same as all words but in reverse order"
     countWordsBeginningWith:" this method should return the amount of words that begin with an inputted string. The optional second parameter should determine what sentence the words come from when present."
</code></pre>

<p>thanks </p>
