Method Object.keysDoIntersect
Summary:
Compares two objects to see if any of thier keys match.
This is a STATIC method and should only be called directly off Object, and not any instances of Object created by the browser or user.
- Calling Convention:
-
Object.keysDoIntersect(object1, object2)
- Parameters
-
- object1
- First object to compare
- object2
- Second object to compare
- Returns:
- boolean true if there are any matches, otherwise boolean false.
Examples
var
test1 = { 'a' : 1, 'b' : 2, 'c' : 3 },
test2 = { 'b' : 1, 'd' : 2, 'e' : 8 },
test3 = { 'e' : 4, 'f' : 4 };
console.log(Object.keysDoIntersect(test1, test2)); // true
console.log(Object.keysDoIntersect(test2, test3)); // true
console.log(Object.keysDoIntersect(test1, test3)); // false