const actions = new Map([ ['1', ['processing']], ['2', ['fail']], ['3', ['fail']], ['4', ['success']], ['5', ['cancel']], ['default', ['other']] ]) const clickHandler = (status) => { let action = actions.get(status) || actions.get('default') sendLog(action[0]) }