basarat / basarat/typescript-book

Truthy conversion: swtich from double negation to Boolean?

Open
#656 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Research direction

Open docs/javascript/truthy.md at the linked line and review the current example using double negation for explicit boolean conversion. Compare it with the proposed Boolean operator and update the example or explanation if appropriate, keeping the surrounding truthy-value guidance accurate.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.