0

array.sort ()

How does the array.sort () achieve “SORT-NUMBER”? And what is the result?

7th Oct 2019, 7:50 AM
guokailu
2 Respuestas
+ 7
Hello, 😊 If you need help, you can post the code you're struggling with!  • SEARCH for similar QUESTIONS or ANSWERS before posting  • Include relevant TAGS  • https://www.sololearn.com/post/75089/?ref=app
7th Oct 2019, 9:01 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 3
Array.sort() is a static method of class Array, when you pass in a refrence as a value to that object it sorts the elements in ascending order but dosent return anything back the reason for this is because the actual object is being edited and not a copy, were as if you passed a primitive type to a method only copy of the value is passed therefore the original value is not affected.
7th Oct 2019, 8:31 AM
D_Stark
D_Stark - avatar