What is difference between sorting string array and sorting numerical array in jquery?



What is difference between sorting string array and sorting numerical array in jquery?..

Answer / Sumant Kumar

In jQuery, when sorting a numeric array, the numbers are sorted as intended because jQuery automatically recognizes them as numeric values. However, when sorting a string array, you need to ensure that the strings are in a format that can be sorted numerically if necessary (e.g., by wrapping the array in the jQuery.makeArray function and using parseFloat or parseInt to convert the elements).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More jQuery Interview Questions

What are the difference between alert() and confirm()?

1 Answers  


What are jquery selectors?

1 Answers  


What is each() function in jQuery? How do you use it?

1 Answers  


What is the starting point of code execution in jquery?

1 Answers  


List the basic selectors in jquery?

1 Answers  


​ What is difference between prop and attr?

1 Answers  


Explain the use of jquery .each() function? : jquery mobile

1 Answers  


Consider a scenario where things can be done easily with javascript, would you still prefer jQuery?

1 Answers  


Define cdn in jquery?

1 Answers  


Can you please explain the difference between event.preventdefault and "return false"? : jquery mobile

1 Answers  


How to check variable is empty or not in jquery?

1 Answers  


What is method chaining in jquery?

1 Answers  


Categories