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]) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter