Exercise on Symbols
The exercises below will give you a deeper understanding of symbol along with the pros and cons of using them.
We'll cover the following...
We'll cover the following...
Exercise 1:
What are the pros and cons of using an underscore prefix for expressing our intention that a field is private? Compare this approach with symbols!
Solution 1:
Pros:
-
Notation and developer experience is simple, provided that your team spreads this practice
-
It does not result in a hard-to-read code structure, all you need is one more character ...