Jquery check if array contains duplicate string

前端 未结 4 974
盖世英雄少女心
盖世英雄少女心 2021-01-14 11:56

How to check if array contains a duplicate string , i have validateArray = [\'sa\',\'sa\',\'yu\'] i have used the following function from SO but same not working for me.

4条回答
  •  天涯浪人
    2021-01-14 12:41

    just use unique() method.

    $.unique(reportRecipients);
    

    https://api.jquery.com/jQuery.unique/

提交回复
热议问题