www.executeprogram.com/courses/modern-javascript/lessons/symbol-basics
1 Users
0 Comments
14 Highlights
0 Notes
Tags
Top Highlights
Normally, object keys are strings
Most JavaScript data types can't be used as object keys
if we try to use true as a key, it gets converted into the string 'true'.
Modern versions of JavaScript have alleviated this limitation by adding symbols
ymbols are a new data type that can be used in object keys
define a symbol by giving it a description: Symbol('name')
equality works like array equality
wo arrays are never equal to each other
false
tore it in a nameSymbol variable and write {nameSymbol: 1}
the unquoted nameSymbol key is just a string
key is 'nameSymbol' and the nameSymbol variable isn't referenced at all
To use the symbol itself as a key, we can use computed property syntax
They allow us to add properties to objects without affecting the "normal" properties.
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.