Array#() : () is an Array class method which performs the comparison between the two arrays.
Parameter: Array for the comparison
Return: -1 : array is less than the other array
0 : array is equal to other array
1 : array is greater than the other array
Example #1 :
comparison : 1 comparison : -1 comparison : -1
Example #2 :
comparison : -1 comparison : -1 comparison : 1
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.