const oddOrEven = (num) => ((num % 2) === 1) ? 'odd' : 'even'; console.log(oddOrEven(1)); console.log(oddOrEven(2)); or, const evenOrOdd = (num) => ((num % 2) === 0) ? 'even' : 'odd'; console.log(evenOrOdd(1)); console.log(evenOrOdd(2));
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