How to iterate with two arrays inside an array using the filter() method











up vote
0
down vote

favorite












How can i get it to enter .map() block?
Is it possible to do this or do i need to approach this issue in another way?



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {
xApplicant.applicantCompetences.map(applComp =>
orderCompetence.map(orderComp => {
console.log(applComp ); //never gets called
console.log(orderComp);//never gets called
return applComp === orderComp;
}));
});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


An object inside nActiveApplicants



nApplicant = {
applicantID: "",
applicantPeriods: ,
applicantCompetences: ,
applicantFullAddress: "",
applicantDuration: ""
};









share|improve this question
























  • First of all Promise.all accepts an array of Promises, second, _applicantCompetenceResults should be a promise and then you can put it in Promise.all. Can you post some nActiveApplicants object sample ?
    – darklightcode
    Nov 19 at 19:46












  • @darklightcode I added some more code.
    – Nathan Berhe
    Nov 19 at 19:50










  • You can't filter Objects. You mean nApplicant is an array of objects ? What about orderCompetence ? is this a separate array ?
    – darklightcode
    Nov 19 at 19:54












  • nActiveApplicants is an array of nApplicants. orderCompetence is a seperate array. @darklightcode
    – Nathan Berhe
    Nov 19 at 19:57












  • Several problems here: 1. You're not returning anything from your filter function. 2. Where is val coming from?
    – Tex
    Nov 19 at 20:01















up vote
0
down vote

favorite












How can i get it to enter .map() block?
Is it possible to do this or do i need to approach this issue in another way?



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {
xApplicant.applicantCompetences.map(applComp =>
orderCompetence.map(orderComp => {
console.log(applComp ); //never gets called
console.log(orderComp);//never gets called
return applComp === orderComp;
}));
});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


An object inside nActiveApplicants



nApplicant = {
applicantID: "",
applicantPeriods: ,
applicantCompetences: ,
applicantFullAddress: "",
applicantDuration: ""
};









share|improve this question
























  • First of all Promise.all accepts an array of Promises, second, _applicantCompetenceResults should be a promise and then you can put it in Promise.all. Can you post some nActiveApplicants object sample ?
    – darklightcode
    Nov 19 at 19:46












  • @darklightcode I added some more code.
    – Nathan Berhe
    Nov 19 at 19:50










  • You can't filter Objects. You mean nApplicant is an array of objects ? What about orderCompetence ? is this a separate array ?
    – darklightcode
    Nov 19 at 19:54












  • nActiveApplicants is an array of nApplicants. orderCompetence is a seperate array. @darklightcode
    – Nathan Berhe
    Nov 19 at 19:57












  • Several problems here: 1. You're not returning anything from your filter function. 2. Where is val coming from?
    – Tex
    Nov 19 at 20:01













up vote
0
down vote

favorite









up vote
0
down vote

favorite











How can i get it to enter .map() block?
Is it possible to do this or do i need to approach this issue in another way?



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {
xApplicant.applicantCompetences.map(applComp =>
orderCompetence.map(orderComp => {
console.log(applComp ); //never gets called
console.log(orderComp);//never gets called
return applComp === orderComp;
}));
});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


An object inside nActiveApplicants



nApplicant = {
applicantID: "",
applicantPeriods: ,
applicantCompetences: ,
applicantFullAddress: "",
applicantDuration: ""
};









share|improve this question















How can i get it to enter .map() block?
Is it possible to do this or do i need to approach this issue in another way?



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {
xApplicant.applicantCompetences.map(applComp =>
orderCompetence.map(orderComp => {
console.log(applComp ); //never gets called
console.log(orderComp);//never gets called
return applComp === orderComp;
}));
});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


An object inside nActiveApplicants



nApplicant = {
applicantID: "",
applicantPeriods: ,
applicantCompetences: ,
applicantFullAddress: "",
applicantDuration: ""
};






javascript node.js google-cloud-functions






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 20:03

























asked Nov 19 at 19:42









Nathan Berhe

33




33












  • First of all Promise.all accepts an array of Promises, second, _applicantCompetenceResults should be a promise and then you can put it in Promise.all. Can you post some nActiveApplicants object sample ?
    – darklightcode
    Nov 19 at 19:46












  • @darklightcode I added some more code.
    – Nathan Berhe
    Nov 19 at 19:50










  • You can't filter Objects. You mean nApplicant is an array of objects ? What about orderCompetence ? is this a separate array ?
    – darklightcode
    Nov 19 at 19:54












  • nActiveApplicants is an array of nApplicants. orderCompetence is a seperate array. @darklightcode
    – Nathan Berhe
    Nov 19 at 19:57












  • Several problems here: 1. You're not returning anything from your filter function. 2. Where is val coming from?
    – Tex
    Nov 19 at 20:01


















  • First of all Promise.all accepts an array of Promises, second, _applicantCompetenceResults should be a promise and then you can put it in Promise.all. Can you post some nActiveApplicants object sample ?
    – darklightcode
    Nov 19 at 19:46












  • @darklightcode I added some more code.
    – Nathan Berhe
    Nov 19 at 19:50










  • You can't filter Objects. You mean nApplicant is an array of objects ? What about orderCompetence ? is this a separate array ?
    – darklightcode
    Nov 19 at 19:54












  • nActiveApplicants is an array of nApplicants. orderCompetence is a seperate array. @darklightcode
    – Nathan Berhe
    Nov 19 at 19:57












  • Several problems here: 1. You're not returning anything from your filter function. 2. Where is val coming from?
    – Tex
    Nov 19 at 20:01
















First of all Promise.all accepts an array of Promises, second, _applicantCompetenceResults should be a promise and then you can put it in Promise.all. Can you post some nActiveApplicants object sample ?
– darklightcode
Nov 19 at 19:46






First of all Promise.all accepts an array of Promises, second, _applicantCompetenceResults should be a promise and then you can put it in Promise.all. Can you post some nActiveApplicants object sample ?
– darklightcode
Nov 19 at 19:46














@darklightcode I added some more code.
– Nathan Berhe
Nov 19 at 19:50




@darklightcode I added some more code.
– Nathan Berhe
Nov 19 at 19:50












You can't filter Objects. You mean nApplicant is an array of objects ? What about orderCompetence ? is this a separate array ?
– darklightcode
Nov 19 at 19:54






You can't filter Objects. You mean nApplicant is an array of objects ? What about orderCompetence ? is this a separate array ?
– darklightcode
Nov 19 at 19:54














nActiveApplicants is an array of nApplicants. orderCompetence is a seperate array. @darklightcode
– Nathan Berhe
Nov 19 at 19:57






nActiveApplicants is an array of nApplicants. orderCompetence is a seperate array. @darklightcode
– Nathan Berhe
Nov 19 at 19:57














Several problems here: 1. You're not returning anything from your filter function. 2. Where is val coming from?
– Tex
Nov 19 at 20:01




Several problems here: 1. You're not returning anything from your filter function. 2. Where is val coming from?
– Tex
Nov 19 at 20:01












2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










I presumed that you want some of the applicantCompetences to exist in orderCompetences, using the find method to search for a valid result, and then filtered it. I mapped the remaining records into Promises.






function MatchCompetences() {

var nActiveApplicants = [{
applicantID: "abcd",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'useless mostly'],
applicantFullAddress: "",
applicantDuration: ""
},
{
applicantID: "efgh",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'singer mostly', 'it-will-do'],
applicantFullAddress: "",
applicantDuration: ""
}
];

var orderCompetence = ['it-will-do'];

var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {

return typeof xApplicant.applicantCompetences.find(elem => {
return orderCompetence.indexOf(elem) !== -1;
}) !== 'undefined'

}).map(item => {

return new Promise(resolve => {
resolve(item);
})

});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log('remaining applicants', resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}

MatchCompetences()








share|improve this answer





















  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35


















up vote
0
down vote













I suspect you want something like this, although it's not clear to me why you'd wrap this in a Promise.all, since I'm pretty certain _applicantCompetenceResults won't be an array of Promises:



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant =>
xApplicant.applicantCompetences.some(applComp => orderCompetences.includes(applComp))
);

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp);
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


If this doesn't do the trick for you, you may want to try to explain what you're hoping to achieve, rather than get into the details of the code you're working with.






share|improve this answer























  • I am trying to get all applicants that have at least 1 matching competence.
    – Nathan Berhe
    Nov 19 at 20:16










  • The example code should do that for you if I understand the data correctly. I have corrected the code since I first posted my answer.
    – Tex
    Nov 19 at 20:17










  • @NathanBerhe I updated this again - I had an errant semi colon that was causing it to fail. I've tested it, and it should solve the actual problem correctly now.
    – Tex
    Nov 19 at 20:30










  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381571%2fhow-to-iterate-with-two-arrays-inside-an-array-using-the-filter-method%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










I presumed that you want some of the applicantCompetences to exist in orderCompetences, using the find method to search for a valid result, and then filtered it. I mapped the remaining records into Promises.






function MatchCompetences() {

var nActiveApplicants = [{
applicantID: "abcd",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'useless mostly'],
applicantFullAddress: "",
applicantDuration: ""
},
{
applicantID: "efgh",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'singer mostly', 'it-will-do'],
applicantFullAddress: "",
applicantDuration: ""
}
];

var orderCompetence = ['it-will-do'];

var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {

return typeof xApplicant.applicantCompetences.find(elem => {
return orderCompetence.indexOf(elem) !== -1;
}) !== 'undefined'

}).map(item => {

return new Promise(resolve => {
resolve(item);
})

});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log('remaining applicants', resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}

MatchCompetences()








share|improve this answer





















  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35















up vote
0
down vote



accepted










I presumed that you want some of the applicantCompetences to exist in orderCompetences, using the find method to search for a valid result, and then filtered it. I mapped the remaining records into Promises.






function MatchCompetences() {

var nActiveApplicants = [{
applicantID: "abcd",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'useless mostly'],
applicantFullAddress: "",
applicantDuration: ""
},
{
applicantID: "efgh",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'singer mostly', 'it-will-do'],
applicantFullAddress: "",
applicantDuration: ""
}
];

var orderCompetence = ['it-will-do'];

var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {

return typeof xApplicant.applicantCompetences.find(elem => {
return orderCompetence.indexOf(elem) !== -1;
}) !== 'undefined'

}).map(item => {

return new Promise(resolve => {
resolve(item);
})

});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log('remaining applicants', resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}

MatchCompetences()








share|improve this answer





















  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35













up vote
0
down vote



accepted







up vote
0
down vote



accepted






I presumed that you want some of the applicantCompetences to exist in orderCompetences, using the find method to search for a valid result, and then filtered it. I mapped the remaining records into Promises.






function MatchCompetences() {

var nActiveApplicants = [{
applicantID: "abcd",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'useless mostly'],
applicantFullAddress: "",
applicantDuration: ""
},
{
applicantID: "efgh",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'singer mostly', 'it-will-do'],
applicantFullAddress: "",
applicantDuration: ""
}
];

var orderCompetence = ['it-will-do'];

var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {

return typeof xApplicant.applicantCompetences.find(elem => {
return orderCompetence.indexOf(elem) !== -1;
}) !== 'undefined'

}).map(item => {

return new Promise(resolve => {
resolve(item);
})

});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log('remaining applicants', resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}

MatchCompetences()








share|improve this answer












I presumed that you want some of the applicantCompetences to exist in orderCompetences, using the find method to search for a valid result, and then filtered it. I mapped the remaining records into Promises.






function MatchCompetences() {

var nActiveApplicants = [{
applicantID: "abcd",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'useless mostly'],
applicantFullAddress: "",
applicantDuration: ""
},
{
applicantID: "efgh",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'singer mostly', 'it-will-do'],
applicantFullAddress: "",
applicantDuration: ""
}
];

var orderCompetence = ['it-will-do'];

var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {

return typeof xApplicant.applicantCompetences.find(elem => {
return orderCompetence.indexOf(elem) !== -1;
}) !== 'undefined'

}).map(item => {

return new Promise(resolve => {
resolve(item);
})

});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log('remaining applicants', resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}

MatchCompetences()








function MatchCompetences() {

var nActiveApplicants = [{
applicantID: "abcd",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'useless mostly'],
applicantFullAddress: "",
applicantDuration: ""
},
{
applicantID: "efgh",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'singer mostly', 'it-will-do'],
applicantFullAddress: "",
applicantDuration: ""
}
];

var orderCompetence = ['it-will-do'];

var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {

return typeof xApplicant.applicantCompetences.find(elem => {
return orderCompetence.indexOf(elem) !== -1;
}) !== 'undefined'

}).map(item => {

return new Promise(resolve => {
resolve(item);
})

});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log('remaining applicants', resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}

MatchCompetences()





function MatchCompetences() {

var nActiveApplicants = [{
applicantID: "abcd",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'useless mostly'],
applicantFullAddress: "",
applicantDuration: ""
},
{
applicantID: "efgh",
applicantPeriods: ,
applicantCompetences: ['can read', 'can talk', 'singer mostly', 'it-will-do'],
applicantFullAddress: "",
applicantDuration: ""
}
];

var orderCompetence = ['it-will-do'];

var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant => {

return typeof xApplicant.applicantCompetences.find(elem => {
return orderCompetence.indexOf(elem) !== -1;
}) !== 'undefined'

}).map(item => {

return new Promise(resolve => {
resolve(item);
})

});

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log('remaining applicants', resp); // Never gets called
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}

MatchCompetences()






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 at 20:17









darklightcode

1,14279




1,14279












  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35


















  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35
















The issue is incorrect data format but thanks for pointing me in the right direction.
– Nathan Berhe
Nov 19 at 20:35




The issue is incorrect data format but thanks for pointing me in the right direction.
– Nathan Berhe
Nov 19 at 20:35












up vote
0
down vote













I suspect you want something like this, although it's not clear to me why you'd wrap this in a Promise.all, since I'm pretty certain _applicantCompetenceResults won't be an array of Promises:



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant =>
xApplicant.applicantCompetences.some(applComp => orderCompetences.includes(applComp))
);

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp);
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


If this doesn't do the trick for you, you may want to try to explain what you're hoping to achieve, rather than get into the details of the code you're working with.






share|improve this answer























  • I am trying to get all applicants that have at least 1 matching competence.
    – Nathan Berhe
    Nov 19 at 20:16










  • The example code should do that for you if I understand the data correctly. I have corrected the code since I first posted my answer.
    – Tex
    Nov 19 at 20:17










  • @NathanBerhe I updated this again - I had an errant semi colon that was causing it to fail. I've tested it, and it should solve the actual problem correctly now.
    – Tex
    Nov 19 at 20:30










  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35















up vote
0
down vote













I suspect you want something like this, although it's not clear to me why you'd wrap this in a Promise.all, since I'm pretty certain _applicantCompetenceResults won't be an array of Promises:



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant =>
xApplicant.applicantCompetences.some(applComp => orderCompetences.includes(applComp))
);

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp);
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


If this doesn't do the trick for you, you may want to try to explain what you're hoping to achieve, rather than get into the details of the code you're working with.






share|improve this answer























  • I am trying to get all applicants that have at least 1 matching competence.
    – Nathan Berhe
    Nov 19 at 20:16










  • The example code should do that for you if I understand the data correctly. I have corrected the code since I first posted my answer.
    – Tex
    Nov 19 at 20:17










  • @NathanBerhe I updated this again - I had an errant semi colon that was causing it to fail. I've tested it, and it should solve the actual problem correctly now.
    – Tex
    Nov 19 at 20:30










  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35













up vote
0
down vote










up vote
0
down vote









I suspect you want something like this, although it's not clear to me why you'd wrap this in a Promise.all, since I'm pretty certain _applicantCompetenceResults won't be an array of Promises:



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant =>
xApplicant.applicantCompetences.some(applComp => orderCompetences.includes(applComp))
);

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp);
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


If this doesn't do the trick for you, you may want to try to explain what you're hoping to achieve, rather than get into the details of the code you're working with.






share|improve this answer














I suspect you want something like this, although it's not clear to me why you'd wrap this in a Promise.all, since I'm pretty certain _applicantCompetenceResults won't be an array of Promises:



var orderCompetences = ;
var nActiveApplicants = ;
function MatchCompetences() {
var _applicantCompetenceResults = nActiveApplicants.filter(xApplicant =>
xApplicant.applicantCompetences.some(applComp => orderCompetences.includes(applComp))
);

return Promise.all(_applicantCompetenceResults)
.then(resp => {
console.log(resp);
return 1;
})
.catch(err => {
console.log(err);
return 0;
});
}


If this doesn't do the trick for you, you may want to try to explain what you're hoping to achieve, rather than get into the details of the code you're working with.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 at 20:27

























answered Nov 19 at 20:10









Tex

1,6031527




1,6031527












  • I am trying to get all applicants that have at least 1 matching competence.
    – Nathan Berhe
    Nov 19 at 20:16










  • The example code should do that for you if I understand the data correctly. I have corrected the code since I first posted my answer.
    – Tex
    Nov 19 at 20:17










  • @NathanBerhe I updated this again - I had an errant semi colon that was causing it to fail. I've tested it, and it should solve the actual problem correctly now.
    – Tex
    Nov 19 at 20:30










  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35


















  • I am trying to get all applicants that have at least 1 matching competence.
    – Nathan Berhe
    Nov 19 at 20:16










  • The example code should do that for you if I understand the data correctly. I have corrected the code since I first posted my answer.
    – Tex
    Nov 19 at 20:17










  • @NathanBerhe I updated this again - I had an errant semi colon that was causing it to fail. I've tested it, and it should solve the actual problem correctly now.
    – Tex
    Nov 19 at 20:30










  • The issue is incorrect data format but thanks for pointing me in the right direction.
    – Nathan Berhe
    Nov 19 at 20:35
















I am trying to get all applicants that have at least 1 matching competence.
– Nathan Berhe
Nov 19 at 20:16




I am trying to get all applicants that have at least 1 matching competence.
– Nathan Berhe
Nov 19 at 20:16












The example code should do that for you if I understand the data correctly. I have corrected the code since I first posted my answer.
– Tex
Nov 19 at 20:17




The example code should do that for you if I understand the data correctly. I have corrected the code since I first posted my answer.
– Tex
Nov 19 at 20:17












@NathanBerhe I updated this again - I had an errant semi colon that was causing it to fail. I've tested it, and it should solve the actual problem correctly now.
– Tex
Nov 19 at 20:30




@NathanBerhe I updated this again - I had an errant semi colon that was causing it to fail. I've tested it, and it should solve the actual problem correctly now.
– Tex
Nov 19 at 20:30












The issue is incorrect data format but thanks for pointing me in the right direction.
– Nathan Berhe
Nov 19 at 20:35




The issue is incorrect data format but thanks for pointing me in the right direction.
– Nathan Berhe
Nov 19 at 20:35


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381571%2fhow-to-iterate-with-two-arrays-inside-an-array-using-the-filter-method%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Create new schema in PostgreSQL using DBeaver

Deepest pit of an array with Javascript: test on Codility

Costa Masnaga