basarat / typescript-book

:books: The definitive guide to TypeScript and possibly the best TypeScript book :book:. Free and Open Source 🌹
https://basarat.gitbook.io/typescript/
Other
20.58k stars 2.52k forks source link

Truthy conversion: swtich from double negation to Boolean? #656

Open keul opened 2 years ago

keul commented 2 years ago

Looking at https://github.com/basarat/typescript-book/blob/120b111141abcffca11e63aa98639fb7d66073a6/docs/javascript/truthy.md?plain=1#L27 I see the book is using the !! for converting something to an explicit boolean value, which is always a bit hacky to read.

What about using the Boolean operator instead?