

InterviewSolution
Saved Bookmarks
1. |
Explain the motivation behind Symbols to ES6. |
Answer» <html><body><p>Symbols are a particular kind of object, newly added in the sixth version of ECMAScript which can be used as a unique property name in the objects. Using Symbol in the place of String (as it was done in the previous versions) allows the programmer to use different modules that can create properties that will not be problematic to each other. Another <a href="https://interviewquestions.tuteehub.com/tag/huge-1032540" style="font-weight:bold;" target="_blank" title="Click to know more about HUGE">HUGE</a> benefit of Symbols is that they can be made private and the properties defined cannot be accessed by any <a href="https://interviewquestions.tuteehub.com/tag/user-25565" style="font-weight:bold;" target="_blank" title="Click to know more about USER">USER</a> or <a href="https://interviewquestions.tuteehub.com/tag/developer-25513" style="font-weight:bold;" target="_blank" title="Click to know more about DEVELOPER">DEVELOPER</a> who does not have direct <a href="https://interviewquestions.tuteehub.com/tag/access-846773" style="font-weight:bold;" target="_blank" title="Click to know more about ACCESS">ACCESS</a> to the Symbol. They <a href="https://interviewquestions.tuteehub.com/tag/comprise-927303" style="font-weight:bold;" target="_blank" title="Click to know more about COMPRISE">COMPRISE</a> of a function that can be used to create different symbols that can work differently. But they do not have any literal syntax, unlike the other primitives of JavaScript.</p></body></html> | |