I have spent many hours doing my research - I'm a total dummy, but I'm not being lazy. I have Reddit/SO/Googled extensively...
Also, I am new to posting on SO and I'm sure I'm doing something wrong - sorry.
Please let me know if I'm on the right track:
"If you don’t have the reference for the Symbol, you just can’t use it"
- Does this mean that you need the variable to which you assigned the symbol as a value (when symbol was created)? And is that useful BECAUSE the scope of that variable is limited? So it's not like something outside the scope of the variable could accidentally use the reference name. There is no NAME to the symbol to be guessed, right? The reference is just a pointer, and the only way to use the pointer is if you are within scope of where the pointer was defined. Is that it?
I'm confused as to why collisions couldn't happen with the reference. I believe this has to do with my ignorance of how different pieces of code interact... Could someone not give my reference as an argument at the wrong place/time, and have it collide with my symbol? Are my variables/scope naturally untouchable by other peoples code, or do I have to purposefully declare variable with symbol value somewhere specific... Ugh it's a never ending Rabbit hole.
Okay well help me if you can. If not I am taking suggestions on what rabbit hole to dive down next.
I suspect that the use of symbols would become clear naturally as I gain experience with how JavaScript is "actually" used - I'm just learning it as a first language - so all I know is simple/linear JavaScript code completely isolated from interacting with any code I have not written. Either way, I'm trying to understand symbols as best I can from where I stand.
question from:
https://stackoverflow.com/questions/65877355/why-are-javascript-symbol-references-safe-from-collisions 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…