This question already has an answer here:
- Sorting an array of JavaScript objects 9 answers
I have an array of objects called 'canvasObjects'
Each object has an attribute called 'z'
I want to sort this array based on objects z. How do I do this using the sort() method?