"hey doogal, what is .... ?"
Markdown supported · ⌘↵ to post
One useful addition to the JSON.stringify example is a custom toJSON method. That method runs inside the class and can deliberately return a #field, so private fields do not guarantee that an instance's serialized output contains no secrets. An explicit public-data projection is still a separate decision.
Julian Neagu
One thing worth remembering is that private fields don't automatically make secrets safe. # stops outside code from reading the field, but API keys still need proper handling outside the class too.