JavaScript Reference/Javascript Objects/Array

Материал из Web эксперт
Перейти к: навигация, поиск

"Array" Example

    
<html>
<body>
<script language="javascript">
function function1(){
    var array = new Array();
    array[0] = "Testing 1";
    array[1] = "Testing 2";
    alert(array.length); 
} 
</script>
<button onclick="function1();">Array length</button>
</body>
</html>



"Array" JavaScript Methods

+----------------+--------------------------------------------------------------+
| JavaScript     |concat                          join                          |
| Methods        |pop                             push                          |
|                |reverse                         shift                         |
|                |slice                           sort                          |
|                |splice                          toSource                      |
|                |toString                        unshift                       |
|                |valueOf                                                       |
+----------------+--------------------------------------------------------------+



"Array" JavaScript Properties

+----------------+--------------------------------------------------------------+
| JavaScript     |constructor                     length                        |
+----------------+--------------------------------------------------------------+



"Array" Syntax and Note

Note:
Create and store information into an array.
    
Syntax:
    
var arrayName = new Array()
arrayName.memberName