Hi guys, I would like to know how to basically retrieve a certain number of characters from the string value inside of an array. So for example.
var news = new Array();
news = “Today a big thing happened that was really big, seriously big, I mean huge!”;
news = “Today I saw a man. He was a man, not a women, an man, as in he was male, not female, defiantly male.”;
news = “Today police discovered what appeared to be an oversized crunchy bar, just lying in the street – unopened.”;
for(var i; i < 2; i++)
Where I have the "document.write" is where I would like there to be a amount of characters output limit, so for news it could just be – "Today a big thing happened".
Im not 100% sure what your asking for but from what it sounds like your interested in extracting a substring.
the above code would write all characters in each item from the 0 character (first character) up to (but not including) the 10th character of the strings. (PS: in a for loop that you will be incrimenting always include a value for the variable or it will throw an error and increase the number by 1 to go through an array. so if the array is 3 entries (0,1, and 2) write either i < 3 or i <= 2.
Is this what you were lookin for?