Data data is designed to address memory leaks, and his theory is that when we store data on an object, we actually save all the data in a separate data object, and this object only provides an interface that can access its own data in its existing data object.
This is a simple data data
vardata = {};functionSet (obj,name,value) {//stores an attribute on an object as an interface for accessing dataObj.expando = 1; //initialize the object and store the data in the location provided by our interfaceData[obj.expando] ={} Data[obj.expando][name]=Value}functionGet (obj,name) {//The fact is that the expando on the object specifies its own data to be accessed in the data location. returnData[obj.expando][name]}varObj2 ={};set (obj2,"Name", "Winder"); Console.log (Get (Obj2,"Name"))//WinderConsole.log (OBJ2)//Object {expando:1}Console.log (Data[1])//Object {name: "Winder"}
It is clear from the code that we are actually accessing objects that are 1 referenced in the data object, and how to find the location of the data is provided by an interface property stored on the object.
When we used him in jquery,
jquery Source notes-Data caching