4 ms·
let bool = !!(whatever) Yuck let bool = Boolean(whatever)
by viklove 7y ago
let bool = !!(whatever)
Yuck
let bool = Boolean(whatever)
- geoelectric 7y agoI don't wholly disagree with you, but I see !! in the wild a lot more than Boolean() and !! is still a JS idiom even if it's not a great one.
- partyboat1586 7y agoWoah, slow down there governor. Don't you be bringing your filthy verbose Java idioms into our precious JavaScript. My father was a ECMAScript programmer and his father before him was a perl hacker. We don't take to kindly to extra unecessary characters around these parts.