vendredi 28 février 2020

Accessing array from JSON in if statement Node.JS

My JSON file looks something like this

module.exports={
    roles: {
        valid:["Area Director"||"Managing Director"|| "Default"]}}

And I'm trying to do this in my Node.js

if(display_title.includes(roles.roles.valid))

I want to check if my display_title includes any of the valid roles from the JSON. My Node.js syntax seems to be wrong.

Aucun commentaire:

Enregistrer un commentaire