Home >Web Front-end >JS Tutorial >Instructions for using date objects, array objects, and two-dimensional arrays in JavaScript_Basic knowledge
1. Date object
Format: Date object name=new Date([date parameter])
Date parameters: 1. Omitted (most commonly used)
3. Numerical format: year, month, day, [hour, minute, second]
For example: today=new Date(2008,10,1);
2. Array object
Create array object:
Format 1: Array object name=new Array([number of elements])
Format 3: Array object name=[Element 1[,Element 2,…]]
The array length is variable, and the array element types can be different
For example: fruit=new Array(3);//fruit=new Array();
fruit[0]=”apple”;
fruit[1]="Yali";
fruit[2]=”orange”;
fruit=new Array("Apple", "Yali", "Orange");
Three and two-dimensional arrays