I have this file
var paragraph = "Abandon| give up or over| yield| surrender| leave| cede| let go| deliver| turn over| relinquish| depart from| leave| desert| quit| go away from| desert| forsake| jilt| walk out on | give up| renounce| discontinue| forgo| drop| desist| abstain from|
recklessness| intemperance| wantonness| lack of restraint| unrestraint|
abandoned |left alone| forlorn| forsaken| deserted| neglected| rejected| shunned| cast off | jilted| dropped| ";
with a lot of spacing, so it's giving me that error at the spacings.
then running a loop and alerting the output
var sentences = paragraph.split("|");
var newparagraph = "";
for (i = 0; i < sentences.length; i++) {
var words = sentences[i].split(" ");
if (words.length < 4) {
newparagraph += sentences[i] + "|";
}
}
alert(newparagraph);
how do I read from a file that doesn't get errors from spacing?