InterviewSolution
| 1. |
console.log(('hello').__proto__.__proto__.__proto__); |
|
Answer» Symbols are the new primitive data-type introduced in ES6. Symbols is unique and immutable data-type. They are tokens that can be used as unique ids. We can ALSO put some value inside the constructor in Symbol, which helps in identifying it. Also, it’s typeof is symbol We cannot directly concatenate it to a Sting as it will throw an error. So, we CONVERT a Symbol into a String by using string in-built function TOSTRING(). One of the use case of Symbol is to be used as unique keys. We can use them very efficiently in Objects and MAPS, where only unique keys are allowed. |
|