Help with constructor
Posted on 2014-09-22
I have an object constructor which expects a string input (initialData). The object constructor returns an object that contains the following methods:
a. getSentences: this method should return an array of the sentences contained in ‘initialData’
b. getWords: this method should return an array of words in ‘initialData’ 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. Not sure how to do this?