Skip to main content

Posts

Showing posts with the label Symbol DataType in JavaScript

The Symbol in JavaScript is the new type of DataType. What they actually do?

The Symbol  is a new primitive type introduced in ES6 . It’s introduced in ES6. Symbols are completely unique identifiers. Just like their primitive counterparts (Number, String, Boolean), they can be created using the factory function Symbol () which returns a Symbol.  List of Symbol Features:- 1.       The Symbol is used to create a unique identifier and every symbol value returned from Symbol() is unique. 2.       The symbol does not auto convert to strings. 3.       Symbols are great to be used as the key in objects. 4.       Two Symbols with the same description is never equal. 5.       The data type symbol is a primitive data type. 6.       While iterating over Objects, Symbol as the key won't be accessible. They become hidden properties. But, Object.assign({}) , Symbol will also get copied. Syntax: -...