Last active
January 26, 2017 13:51
-
-
Save gonaumov/22737da3a36f0c1f5463129ab5f714cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var firstArr = [{someProp: 1},{someProp: 2}]; | |
var secondArr = [{someProp: 2},{someProp: 4}]; | |
var isThereEquals = firstArr.some(function (item) { | |
return secondArr.some(function (other) { | |
return other.someProp === item.someProp; | |
}) | |
}); | |
// this will be true because | |
// in the both arrays there is | |
// someProp 2 | |
console.log(isThereEquals); | |
var firstArr = [{someProp: 1},{someProp: 2}]; | |
var secondArr = [{someProp: 3},{someProp: 4}]; | |
var isThereEquals = firstArr.some(function (item) { | |
return secondArr.some(function (other) { | |
return other.someProp === item.someProp; | |
}) | |
}); | |
// this will be false because | |
// in the both arrays there is | |
// no equal someProp | |
console.log(isThereEquals); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment