So I have a paragraph of string and need to separate it by period. How do I get the first 2 sentence?
Here is what I have :
var text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus."
text.split(".");
for (i=0;i <2;i++) {
//i dont know what to put here to get the sentence
}
First two sentences should be:
JS Fiddle demo.
References:
join().slice().split().