116
rated 0 times
[
117]
[
1]
/ answers: 1 / hits: 46524
/ 6 Years ago, tue, july 24, 2018, 12:00:00
I have this data:
roles = [
{roleId: 69801, role: ADMIN}
{roleId: 69806, role: SUPER_ADMIN}
{roleId: 69805, role: RB}
{roleId: 69804, role: PILOTE}
{roleId: 69808, role: VENDEUR}
{roleId: 69807, role: SUPER_RB}
]
i have to filter my table to check if there is an object containing a specifie value of role .
My function should look like this :
checkRoleExistence(role){
// if role exists on one of the objects return true
// else returne false
}
to use it i would do s.th like this :
let ifExists = this.checkRoleExistence(PILOTE) ;
I would like to use the filter function of Ecmascript .
Suggestions ?
More From » arrays