I want to create a JSON object that is organized alphabetically as follows:
var Dictionary = {};
var AlphabetString = "abcdefghijklmnopqrstuvwxyz";
for (x in AlphabetString) {
Dictionary[x] = new Array();
}
var TestingString = ["apples, bannans, carrots, dice"];
for (x in TestingString) {
Dictionary[TestingString.charAt(0)].push(TestingString);
}
So that Dictionary at each alphabet will give me an array of strings that have the same first letter as the identifier i.e. in my example Dictionary["a"] = ["apples"]. Is this the correct way to go about this?