friends.
I have an array and it contains some string values.
ex: array name=”All_array”
Now i want to check all values in that array for first character of a string.
if a String starts with character ‘a’ then move that string to array called “A_array”.
if a String starts with character ‘b’ then move that string to array called “B_array”.
How to achieve this task.
This will take every element in
All_arrayand put them into an object containing the arrays indexed by the first letter of the elements inAll_array, like this:etc…
Here’s a fiddle: http://jsfiddle.net/svjJ9/