Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function whatIsInAName(first, second) {
- var srcKeys = Object.keys(second);
- //console.log(srcKeys);
- // filter the collection
- return first.filter(function(obj) {
- for (var i = 0; i < srcKeys.length; i++) {
- //console.log("srckeys[i]: " + srcKeys[i]);
- //console.log("obj[srckeys[i]]: " + obj[srcKeys[i]]);
- if (
- !obj.hasOwnProperty(srcKeys[i]) ||
- obj[srcKeys[i]] !== second[srcKeys[i]]
- ) {
- return false;
- }
- }
- return true;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement