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 ?
My function should look like this- it's empty? I don't think it should look like that at all - I think you need to put some code in therefilter, I personally would have usedsome. And you can change the language !