Does autovivification only have to do with "derefencing" undefined structures, because in JavaScript if you specify a index or a property that doesn't exist won't it dynamically create it? But is this not autovivification because you must declare the underlying structure to first be an object or an array?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
ES6's
Proxy
can be used for implementing autovivification,Test:
Namespacing is one area where autovivification might be handy in JavaScript. Currently to "namespace" an object, you have to do this:
Were autovivification supported by JavaScript, the first line would not be necessary. The ability to add arbitrary properties to objects in JavaScript is due to its being a dynamic language, but is not quite autovivification.