I have an object array called Persons and would like to sort by one of its members, I am new to javascript prorotype and not sure how to do this. The object looks like this:
[ Object { EntityId=0, Name="Edibert", Number="1234", Value=""}]
[ Object { EntityId=0, Name="Jairo", Number="1234", Value=""}]
So it has a few more items there for that array of object Persons. I know i can access the name by doing something like this.Persons[0].Name. But how can i sort it by Name?.
thank you so much
You can do this without Prototype:
Use any properties of the object you want from within the
sortfunction, so long as you return one of the following values:In reality, any negative or positive number would work as a return value, but
-1and1are conventional.