Is there any Possible or best way to Handle this

Hey Engineers is there any other good or effective way to do this kind of conditions other than this.
action === ‘add’
? ‘Add New Hierarchy Node’
: action === ‘delete’
? ‘Remove Hierarchy Node’
: action === ‘edit’
? ‘Edit Hierarchy Node Name’
: action === ‘assign’
? ‘Assign a Profile’
: action === ‘deleteProfile’
? ‘Remove Profile’
: ‘’

What about using an object lookup?

Are you sure that’s it?

It is better than lots of ternary statements.

Thanks @RandellDawson I’ll try it and see if it works to my scenario.

Sorry, I’m new to coding, so I’m just trying to be helpful! :wink: