Skip to content

Commit

Permalink
Merge pull request basarat#526 from michalkopanski/patch-1
Browse files Browse the repository at this point in the history
Fix typo in "Null vs. Undefined" section
  • Loading branch information
basarat committed Oct 22, 2019
2 parents b28a730 + c9af4a4 commit 158eabf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/javascript/null-undefined.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ JSON.stringify({willStay: null, willBeGone: undefined}); // {"willStay":null}

As a result, JSON-based databases may support `null` values but not `undefined` values. Since attributes set to `null` are encoded, you can transmit the intent to clear an attribute by setting its value to `null` before encoding and transmitting the object to a remote store.

Setting attribute values to undefined can save of storage and transmission costs, as the attribute names will not be encoded. However, this can complicate the semantics of clearing values vs. absent values.
Setting attribute values to undefined can save on storage and transmission costs, as the attribute names will not be encoded. However, this can complicate the semantics of clearing values vs. absent values.

### Final thoughts
TypeScript team doesn't use `null` : [TypeScript coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#null-and-undefined) and it hasn't caused any problems. Douglas Crockford thinks [`null` is a bad idea](https://www.youtube.com/watch?v=PSGEjv3Tqo0&feature=youtu.be&t=9m21s) and we should all just use `undefined`.
Expand Down

0 comments on commit 158eabf

Please sign in to comment.