var Scriptures = JSON.parse( fs.readFileSync(scriptures.json, 'utf8') );
_.each(Scriptures, function (s, Scripture) {
return Scripture;
});
This code extracts and displays the names of each book from a collection of scriptures (e.g., Genesis, Exodus, Leviticus). The issue at hand is that the books in the JSON file are not arranged properly. Numerous attempts have been made to sort them within the _.each loop without success. An approach like this:
correctlyOrderedIndex.indexOf(Scripture) - correctlyOrderedIndex.indexOf(s);
accurately retrieved the index of each item, yet sorting them inside the _.each loop appears to be impossible. Is there a way to pre-arrange the order before entering the _.each loop or perhaps an alternative method to sort them while looping through?