Arrays are defined in four different ways
Using constructors:
var a = new Array ();
var B = new Array (10);
var c = new Array ("A", "second", "third");
or the direct amount of the array:
var d = ["A", "second", "third"];
Extended:
function Objstory (id,biaoti,author,type)//Declaration object
{
this.id = ID;
This. Biaoti= Biaoti;
This. Author= Author;
This. type = type;
}
var arr = new Array ()//Declaration array, used to store header information
var writer= new Objstory (11, ' Everyone go to see the sea ', ' Li Bold ', ' literary class ');/Declare object
Arr[0]=writer ;//Add objects to the collection
Another method:
var array=[];
Array.push (New Objstory (12, ' Everyone goes to see the sea ', ' Lee Bold ', ' literary class '));
Array.push (New Objstory (14, ' everyone to see the day ', ' Li Xiao ', ' literary class '));
The above JS declaration of the array and add object variables to the array of simple examples is the small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.