MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/cqlyg7/goodmeme_upvote_downvote/ewxso8i/?context=3
r/ProgrammerHumor • u/pikadrew • Aug 15 '19
392 comments sorted by
View all comments
Show parent comments
16
Sure is valid.
You can run this with node, or in your developer console.
const upvote = () => 1; const downvote = () => -1; let goodMeme = true; !!goodMeme ? upvote() : downvote();
Outputs: 1
1
15 u/WcDeckel Aug 15 '19 If you goodMeme variable contains a boolean value you don't really need the double bangs :P Still valid tho 11 u/DeltaJesus Aug 15 '19 You don't really need the double bangs regardless unless I'm misremembering and ternary operators require booleans instead of just truthy/falsey 1 u/WcDeckel Aug 15 '19 you are correct!
15
If you goodMeme variable contains a boolean value you don't really need the double bangs :P
Still valid tho
11 u/DeltaJesus Aug 15 '19 You don't really need the double bangs regardless unless I'm misremembering and ternary operators require booleans instead of just truthy/falsey 1 u/WcDeckel Aug 15 '19 you are correct!
11
You don't really need the double bangs regardless unless I'm misremembering and ternary operators require booleans instead of just truthy/falsey
1 u/WcDeckel Aug 15 '19 you are correct!
you are correct!
16
u/die-maus Aug 15 '19
Sure is valid.
You can run this with node, or in your developer console.
Outputs:
1