Get Selected Node Data In Selected Order

How can i get selected node data in the same order as it is placed using Diagram.selection collection
i am getting data in reverse order while i am using this …
taken reference form Link :

$scope.myDiagram.selection.each(function (part) {
if (part instanceof go.Node) {

The order of Parts in the Diagram.selection collection is the order in which they were selected.

If you want a different order, I think you’ll need to copy the collection to your own Array or List and sort it according to whatever criteria that you like.