menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Inside the...
source image

Medium

3w

read

114

img
dot

Image Credit: Medium

Inside the Mechanics of JavaScript Symbol Properties

  • JavaScript introduced the Symbol type to create hidden property keys.
  • Symbols do not show up when objects are looped over or printed out.
  • To create a Symbol, the Symbol() function is used.
  • Symbols are unique with the same description strings yielding different values.
  • Symbols behave as object keys by being matched by identity.
  • Symbol properties are stored separately and do not mix with string keys.
  • Symbol keys are treated differently in property lookups and iterations.
  • Symbols are flagged as non-enumerable and skipped in common lookup methods.
  • Symbol properties can be accessed using Object.getOwnPropertySymbols().
  • Symbols are ideal for hiding data within objects and maintaining privacy.

Read Full Article

like

6 Likes

For uninterrupted reading, download the app