EchoEcho.Com Homepage
Web Hosting - As Reliable As It Gets!
   Home > References > JavaScript > Array Object


 Tutorials 
 D-Zine Articles 
 Online Tools 
 Free Resources 
 References 
 Quiz 
 Hosting 

















  JavaScript Objects :
ARRAY OBJECT








Core ObjectNNIEECMA
 Array Multidimensional variable2+4+ECMA 1
 
MethodsNNIEECMA
 concat() Combines two existing Array objects to one3+4+ECMA 1
 join() Returns a string with elements from an Array2+4+ECMA 1
 pop() Removes the last value from an Array.3+5.5+ECMA 1
 push() Appends a value to the end of an Array.3+5.5+ECMA 1
 reverse() Reverse the order of elements in an Array.2+4+ECMA 1
 shift() Removes the first value from an Array.3+5.5+ECMA 1
 slice() Returns a subset from an Array.3+4+ECMA 1
 sort() Sorts an Array.2+4+ECMA 1
 splice() Adds new elements to an Array while removing old elements.3+4+ECMA 1
 toLocaleString() Returns a String with current locale format and separators.n/a4+ECMA 1
 toSource() String representing the source code of the object.4+n/an/a
 toString() Returns Array elements as string type separated by commas.2+4+ECMA 1
 unshift() Inserts a value at the beginning of an Array.3+5.5+ECMA 1
 valueOf() Returns Array elements as string type separated by commas.2+4+n/a
 
PropertiesNNIEECMA
 constructor Reference to the function that created an object.2+4+ECMA 1
 index Zero-based index of the match for array created by a regular expression match.3+4+n/a
 input Original string used to match for array created by a regular expression match.3+4+n/a
 length Returns the length of an Array2+4+ECMA 1
 prototype Creates a new method for Array objects2+4+ECMA 1





 Array Core object 
 Multidimensional variable
 
Syntax:

Syntax 1
  var myArray = new Array()


Syntax 2
  var myArray = new Array(sizeInteger)


Syntax 3
  var myArray = new Array(element0, element1, ..., elementN)

 
Browser support:
 Microsoft Internet Explorer: 4+
 Netscape Browser: 2+
 
Implementations:
 JavaScript 1.1 (by Netscape)
 JScript 2 (by Microsoft)
 ECMA Script 1 (ECMA Standard)
 
 
Example:

Example 1 :

  var myArray = new Array();
  myArray[0]='Mercedes';
  myArray[1]='Volvo';
  alert('The last car is a '+myArray[1]);


Example 2 :

  var myArray = new Array('Mercedes','Volvo');
  alert('The last car is a '+myArray[1]);



















DEVELOPER TIP!
FACT:
On the web's 100 most visited sites you will not find a single word that is written outside a table!
TIP:
Use of invisible tables is the most popular method for layout on web pages.





     "Better Than Books - As Easy As It Gets!"


On EchoEcho: D-Zine Articles | Tutorials | Online Tools | Free Resources | References | Quiz | HostingAbout EchoEcho