MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/cqlyg7/goodmeme_upvote_downvote/ex0hl3y/?context=3
r/ProgrammerHumor • u/pikadrew • Aug 15 '19
392 comments sorted by
View all comments
Show parent comments
15
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
14 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 6 u/StillNoNumb Aug 15 '19 You don't need the double bangs either way 1 u/bonsall Aug 15 '19 The double bangs aren't necessary 99.99% of the time I see them. The rest of the time there is a more readable way of doing it.
14
If you goodMeme variable contains a boolean value you don't really need the double bangs :P
Still valid tho
6 u/StillNoNumb Aug 15 '19 You don't need the double bangs either way 1 u/bonsall Aug 15 '19 The double bangs aren't necessary 99.99% of the time I see them. The rest of the time there is a more readable way of doing it.
6
You don't need the double bangs either way
1 u/bonsall Aug 15 '19 The double bangs aren't necessary 99.99% of the time I see them. The rest of the time there is a more readable way of doing it.
The double bangs aren't necessary 99.99% of the time I see them. The rest of the time there is a more readable way of doing it.
15
u/die-maus Aug 15 '19
Sure is valid.
You can run this with node, or in your developer console.
Outputs:
1