Skip to content

Instantly share code, notes, and snippets.

@gonaumov
Last active January 26, 2017 13:51
Show Gist options
  • Save gonaumov/22737da3a36f0c1f5463129ab5f714cb to your computer and use it in GitHub Desktop.
Save gonaumov/22737da3a36f0c1f5463129ab5f714cb to your computer and use it in GitHub Desktop.
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