5 ms·
The same is in JavaScript: return (twitterUrl && config.twitter) || (githubUrl && config.github) || default
by degif 7y ago
The same is in JavaScript:
return (twitterUrl && config.twitter) || (githubUrl && config.github) || default
- masklinn 7y agoSeems like an unnecessary mess when you could just use ternary expressions: return twitterUrl ? config.twitter : githubUrl ? config.github : default
- Y-bar 7y agoI envy you, I’d love to grok ternary expressions better but every time I just end up having to spend a long time unrolling the logic.