jQuery.unique on an array of strings

后端 未结 8 562
野趣味
野趣味 2020-11-29 05:16

The description of jQuery.unique() states:

Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays

8条回答
  •  感情败类
    2020-11-29 05:35

    $.unique will remove duplicate DOM elements, not identical DOM elements. When you try to use it on strings, you get unpredictable behavior and the sorting will (probably) fail.

    It's a function intended for internal use by jQuery only, and won't be useful to mere mortals like you and I.

提交回复
热议问题