/* function functionName(condition) { switch(condition) { case value1 : Statement1 case value2 : Statement2 default : Statement3 } } */ function isRose(cat) { switch(cat) { case 'rose' : return 'Hi, Rose!' case 'ted' : return 'Hi, Ted!' default : return `Hi, ${cat}!` } }
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