I would like to do this shorter?
function getRedditImg (img) {
if (img === 'default') {
return 'https://i.imgur.com/pMkc6Lo.png'
} else if (img === 'self') {
return 'https://i.imgur.com/pMkc6Lo.png'
}
return img
}
I tried doing this:
post.thumbnail === ( 'default' || 'self') ? 'https://i.imgur.com/pMkc6Lo.png' : post.thumbnail
But, it short circuits of default its true...
Any ideas? Thanks.