JavaScript Array
来源:互联网 发布:自制短片软件 编辑:程序博客网 时间:2024/04/29 14:37
JavaScript provides both a long way and a shortcut to generate and populate an array. The long way is to use the Array object constructor. If you specify no parameters for the constructor, you create an empty array, which you may then populate with data entry by entry:
var myArray = new Array( );myArray[0] = "Alice";myArray[1] = "Fred";...
You do not have to declare a fixed size for an array when you create it, but you may do so if you wish, by passing a single integer value as a parameter to the constructor method:
var myArray = new Array(12);
This creates an array of 12 entries whose values are null.
If you supply more than one comma-delimited parameter to the constructor method, the arguments are treated as data for the array entries. Thus, the following statement:
var myArray = new Array("Alice", "Fred", "Jean");
creates a three-item array, each item containing a string value.
A shortcut approach to the same action lets you use square brackets to symbolize the array constructor:
var myArray = ["Alice", "Fred", "Jean"];
You can use the shortcut syntax in IE 4 or later and NN 4 or later.
Array 对象的方法
FF: Firefox, N: Netscape, IE: Internet Explorer
Array 对象的属性
FF: Firefox, N: Netscape, IE: Internet Explorer
- [Javascript Array] Array
- JavaScript-Array & Array like
- JavaScript Array
- javascript array
- JavaScript Array
- javascript Array
- Javascript Array
- javascript array
- javascript Array
- JavaScript Array
- JavaScript:Array
- JavaScript array
- Javascript Array
- JavaScript Array
- JavaScript Array
- JavaScript Array
- JavaScript Array
- JavaScript.Array
- JavaScript Boolean
- 共用体成员的引用
- 初步匹配时的问题
- 在测试katmai的时候发现的global的问题
- 给年轻工程师的十大忠告
- JavaScript Array
- Ubuntu 8.04 DVD版的安装(wubi方式)
- jconsole工具介绍
- 软件逆向分析简介
- SDK动态创建按钮
- 在夏天看《立春》
- JavaScript Math (数学对象)
- 因为无聊,所以焦燥
- ProgressBar 进度条组件封装