How can i find the similarity in 2 arrays

Kashif Hashmi

I have 2 arrays:

var arr1 = ['2','3','4'];
var arr2 = ['2'] or ['2', '3'] or ['2','3','4'] or ['3', '4', '5'] or ['5','6'];

If arr2 has similarity to arr1 return true, and if not similar like ['5','6'] then return false even return false when arr2 is ['3', '4', '5'].

Kashif Hashmi
var arr1 = ['2', '3', '5', '7'];
var arr2 = ['3', '4', '8'];

for(i=0; i<arr2.length; i++){

    if(jQuery.inArray(arr2[i], arr1)== -1){
        console.log(arr2[i] + ' Is not in Arr1');
    }

}

4 Is not in Arr1 8 Is not in Arr1

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I check for word similarity from a list in JavaScript (without looping through an entire dictionary)?

分類Dev

How can I print multidimensional arrays in C?

分類Dev

I need to find related data from 2 associative arrays

分類Dev

How can I find the version of Ubuntu that is installed?

分類Dev

How can I find my DHCP server?

分類Dev

How can I find the id of a gang in OpenACC?

分類Dev

How can I find and copy using gsutil?

分類Dev

How can I list files with find and Perl?

分類Dev

How can I find available network interfaces?

分類Dev

How can I find my DHCP server?

分類Dev

how can i find two substrings

分類Dev

How can I find a Ubuntu package to use with Amazon EC2?

分類Dev

How can I use regex to find if a string has 2 specific characters and remove them if they are?

分類Dev

How can I find a Ubuntu package to use with Amazon EC2?

分類Dev

Kotlin: How can I reduce child arrays into a single array?

分類Dev

How can I convert a text file into a list of int arrays

分類Dev

2 arrays, find every permutation

分類Dev

How can I find why system can not run my application?

分類Dev

How can I find the answers I gave in a Jhipster project?

分類Dev

Where can I find bunzip (not bunzip2)?

分類Dev

Can I pass arrays as a "ParamArray"?

分類Dev

How can I find application using hard drive?

分類Dev

How can I find all the APIs of my website?

分類Dev

How can I access value of ID to find the average?

分類Dev

How can I find second key name in JSON using javascript

分類Dev

How can I find current element on mouseover using jQuery?

分類Dev

How can I find the Id property or properties related to a navigational property?

分類Dev

How can i find out facebook API version

分類Dev

How can i find out size of RethinkDB table?

Related 関連記事

  1. 1

    How can I check for word similarity from a list in JavaScript (without looping through an entire dictionary)?

  2. 2

    How can I print multidimensional arrays in C?

  3. 3

    I need to find related data from 2 associative arrays

  4. 4

    How can I find the version of Ubuntu that is installed?

  5. 5

    How can I find my DHCP server?

  6. 6

    How can I find the id of a gang in OpenACC?

  7. 7

    How can I find and copy using gsutil?

  8. 8

    How can I list files with find and Perl?

  9. 9

    How can I find available network interfaces?

  10. 10

    How can I find my DHCP server?

  11. 11

    how can i find two substrings

  12. 12

    How can I find a Ubuntu package to use with Amazon EC2?

  13. 13

    How can I use regex to find if a string has 2 specific characters and remove them if they are?

  14. 14

    How can I find a Ubuntu package to use with Amazon EC2?

  15. 15

    Kotlin: How can I reduce child arrays into a single array?

  16. 16

    How can I convert a text file into a list of int arrays

  17. 17

    2 arrays, find every permutation

  18. 18

    How can I find why system can not run my application?

  19. 19

    How can I find the answers I gave in a Jhipster project?

  20. 20

    Where can I find bunzip (not bunzip2)?

  21. 21

    Can I pass arrays as a "ParamArray"?

  22. 22

    How can I find application using hard drive?

  23. 23

    How can I find all the APIs of my website?

  24. 24

    How can I access value of ID to find the average?

  25. 25

    How can I find second key name in JSON using javascript

  26. 26

    How can I find current element on mouseover using jQuery?

  27. 27

    How can I find the Id property or properties related to a navigational property?

  28. 28

    How can i find out facebook API version

  29. 29

    How can i find out size of RethinkDB table?

ホットタグ

アーカイブ