javascript shorten string without cutting words
<p>I'm not very good with string manipulation in javascript and i was wondering how you would go about shortening a string without cutting any word off. I know how to use substring but not indexof or anything really well.</p>

<p>say i had the string text = "this is a long string i cant display" i want to trim it down to 10 characters but if it doesnt end with a space finish the word i don't want the string variable to look like this "this is a long string i cant dis" i want it to finish the word until a space occurs.</p>
