adspace


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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How to always reference latest version of jquery?

875


Do you have plans for a new jquery plug-in or something else we should look out for? Where to from here for the imgpreview plugin?

864


How can jquery library be added to pages?

952


What is the minimum setup needed to start using jquery.

939


How do you install/use jquery in a project. What is the minimum setup needed to start using jquery.

999


How to validate email using jquery?

975