const partsOfTheDay = () => { let hour = new Date().getHours(); let text = ["It's morning", "It's afternoon", "It's evening", "It's night"]; var timeOfDay = text[hour < 12 ? 0 : hour < 18 ? 1 : hour < 22 ? 2 : 3]; return timeOfDay; }
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