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: ""
};
javascript node.js google-cloud-functions
|
show 2 more comments
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: ""
};
javascript node.js google-cloud-functions
First of allPromise.all
accepts an array of Promises, second,_applicantCompetenceResults
should be a promise and then you can put it inPromise.all
. Can you post somenActiveApplicants
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 meannApplicant
is an array of objects ? What aboutorderCompetence
? is this a separate array ?
– darklightcode
Nov 19 at 19:54
nActiveApplicants
is an array ofnApplicants
.orderCompetence
is a seperate array. @darklightcode
– Nathan Berhe
Nov 19 at 19:57
Several problems here: 1. You're not returning anything from yourfilter
function. 2. Where isval
coming from?
– Tex
Nov 19 at 20:01
|
show 2 more comments
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: ""
};
javascript node.js google-cloud-functions
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
javascript node.js google-cloud-functions
edited Nov 19 at 20:03
asked Nov 19 at 19:42
Nathan Berhe
33
33
First of allPromise.all
accepts an array of Promises, second,_applicantCompetenceResults
should be a promise and then you can put it inPromise.all
. Can you post somenActiveApplicants
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 meannApplicant
is an array of objects ? What aboutorderCompetence
? is this a separate array ?
– darklightcode
Nov 19 at 19:54
nActiveApplicants
is an array ofnApplicants
.orderCompetence
is a seperate array. @darklightcode
– Nathan Berhe
Nov 19 at 19:57
Several problems here: 1. You're not returning anything from yourfilter
function. 2. Where isval
coming from?
– Tex
Nov 19 at 20:01
|
show 2 more comments
First of allPromise.all
accepts an array of Promises, second,_applicantCompetenceResults
should be a promise and then you can put it inPromise.all
. Can you post somenActiveApplicants
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 meannApplicant
is an array of objects ? What aboutorderCompetence
? is this a separate array ?
– darklightcode
Nov 19 at 19:54
nActiveApplicants
is an array ofnApplicants
.orderCompetence
is a seperate array. @darklightcode
– Nathan Berhe
Nov 19 at 19:57
Several problems here: 1. You're not returning anything from yourfilter
function. 2. Where isval
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
|
show 2 more comments
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()
The issue is incorrect data format but thanks for pointing me in the right direction.
– Nathan Berhe
Nov 19 at 20:35
add a comment |
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.
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
add a comment |
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()
The issue is incorrect data format but thanks for pointing me in the right direction.
– Nathan Berhe
Nov 19 at 20:35
add a comment |
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()
The issue is incorrect data format but thanks for pointing me in the right direction.
– Nathan Berhe
Nov 19 at 20:35
add a comment |
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()
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()
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
add a comment |
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
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
First of all
Promise.all
accepts an array of Promises, second,_applicantCompetenceResults
should be a promise and then you can put it inPromise.all
. Can you post somenActiveApplicants
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 aboutorderCompetence
? is this a separate array ?– darklightcode
Nov 19 at 19:54
nActiveApplicants
is an array ofnApplicants
.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 isval
coming from?– Tex
Nov 19 at 20:01