可能性の重複:
Using jQuery to compare two arrays
比較配列
Iが配列別の配列の全て値が含まかどうかを決定するためにJavaScriptやjQueryの機能を必要とします。 2番目の配列は最初の配列よりも多くの値を持つことができます。
true
またはfalse
のいずれかを返します。例えば。
comparing array1 = [1,2,3] and array2 = [1,2] should return false
comparing array1 = [1,2,3] and array2 = [1,1,2] should return false
comparing array1 = [1,2,3] and array2 = [3,2,1] should return true
comparing array1 = [1,2,3] and array2 = [1,2,1,3] should return true
パフォーマンスは関係ありません。ありがとう!
http://api.jquery.com/jQuery.inArray/ –
同様の質問でhttp ://stackoverflow.com/questions/1773069/using-jquery-to-compare-two-arraysこれらの答えは私に役立ちました。 – GrantVS