array.sort () | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

array.sort ()

How does the array.sort () achieve ā€œSORT-NUMBERā€? And ļæ¼ļæ¼ļæ¼ļæ¼ļæ¼what is the resultļ¼Ÿ

7th Oct 2019, 7:50 AM
guokailu
2 Respostas
+ 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