A “symbol” represents a unique identifier.
A value of this type can be created using Symbol():
Symbols allow us to create “hidden” properties of an object, that no other part of code can accidentally access or overwrite.
Symbols are skipped by for…in
Symbol is used when:
“Hidden” object properties. If we want to add a property into an object that “belongs” to another script or a library, we can create a symbol and use it as a property key. A symbolic property does not appear in for..in, so it won’t be accidentally processed together with other properties. Also it won’t be accessed directly, because another script does not have our symbol. So the property will be protected from accidental use or overwrite.
Watch video symbol datatype in javascript | consfused when and where to use symbol? online without registration, duration hours minute second in high quality. This video was added by user Quick Code Academy 22 February 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,408 once and liked it 133 people.