For example, if you need to use an attribute of an object returned by an external method (assuming that this attribute is not of Object type and may be updated and cannot be saved as a variable...), will you store the key of this attribute? In case the attribute name is changed, just change the amount directly~
Also, when I wrote it, I defined a global object with an attribute named id. So if I want to add a value to the object during program iteration in the future, what should I do if there is a key name that is more consistent with the id key name and I want to change it... …
In fact, in most cases, this is used directly. Sometimes you have to trust the value of the external method.
This must be defined the first time. After all,
id
this kind of name cannot be changed just by changing it.If the subject is worried, you can define a
config
file globally.Where you want to define:
Wherever you want to quote, you have to take out the key stored in the global config:
It’s just that it’s more troublesome, but it can still be implemented. At that time, you only need to change the name corresponding to each key in the config file object to achieve uniqueness.
Determine a constant const