Number vs BigInt
- BigInt can’t be used to represent a decimal value, only integers (as the name would suggest)
- BigInt values can exceed the maximum safely allowed by Number values
- Coercion between the two should be avoided where possible as precision is lost when coercing from BigInt to Number\
Symbols
A Symbol is a primitive which is guaranteed to be unique. They can also be used as keys for objects, the only primitive type other than strings.
They also enable semi-private object fields, since listing an object’s keys using Object.keys()
will not include those which use a symbol.
For an in-depth article on symbols, see:
JavaScript Symbols: But Why?