mirror of
https://github.com/labs42io/clean-code-typescript.git
synced 2024-11-23 13:44:04 +00:00
Comments - fixed bad sample
This commit is contained in:
parent
79dbfdee46
commit
b5c0dc3998
|
@ -251,13 +251,13 @@ Comments are an apology, not a requirement. Good code mostly documents itself.
|
|||
|
||||
```ts
|
||||
// Check if subscription is active.
|
||||
if (subscription.endDate < Date.now) { }
|
||||
if (subscription.endDate > Date.now) { }
|
||||
```
|
||||
|
||||
**Good:**
|
||||
|
||||
```ts
|
||||
const isSubscriptionActive = subscription.endDate < Date.now;
|
||||
const isSubscriptionActive = subscription.endDate > Date.now;
|
||||
if (isSubscriptionActive) { /* ... */ }
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue