Frontend developer by day, iOS developer by night. Currently working on learning iOS development and my own blog, Mike Decodes, where I'm decoding the tech industry. Come hang out with me on Twitter!
Great question! I don't fully understand Symbols myself, but I do know that they are a primitive data type under the surface. This means they are, data wise, the same as numbers (int / float), booleans, strings, etc. They cannot be mutated (=ability to change) just like the other primitives.
From what I understand, their main use case is being an identifier for object properties.
Yeah I think the time I saw them used that made sense was in the O’Reilly book Learning JavaScript where they were used to prevent an object property being accessed directly - they’d have to be accessed using get or set methods instead. But I think there are easier ways to achieve this like proxies.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great question! I don't fully understand Symbols myself, but I do know that they are a primitive data type under the surface. This means they are, data wise, the same as numbers (int / float), booleans, strings, etc. They cannot be mutated (=ability to change) just like the other primitives.
From what I understand, their main use case is being an identifier for object properties.
Yeah I think the time I saw them used that made sense was in the O’Reilly book Learning JavaScript where they were used to prevent an object property being accessed directly - they’d have to be accessed using get or set methods instead. But I think there are easier ways to achieve this like proxies.