These are a primitive types (alongside string, number, undefined, null, and boolean). No two symbols are equal and thus if you use a symbol as the name of a property on an object other code cannot stamp over top of it later on downstream. This has this example:
const NAME = Symbol()
const person = {
[NAME]: 'Flavio'
}
No comments:
Post a Comment