I know in javascript if I want define an array,I use:
var arr=new array();
However,this array could only use for store date,int,string,just the javascript already defined
Suppose I have already my custom datatype:
function LayerInfo(uuid, top, left, index, pindex) {
this.uuid = uuid;
this.top = top;
this.left = left;
this.index = index;
this.pindex = pindex;
}
How can I initialize an array which the data type is the "LayerInfo",could store the "LayerInfo"?
like
var l=new LayerInfo()?
if this could be done ,how can I let the layerinfo push into the array,or pull it out?
var arr = [];
. Arrays can hold instances of any type. What is your question? – zzzzBov Mar 12 '12 at 14:13LayerInfo
instance in that array?* You might be surprised! – Matt Mar 12 '12 at 14:14