JAVASCRIPT

 Home  Computers & Internet  Web Programming JAVASCRIPT
What is Javascript?
Javascript Placement
Syntax
Reserved Words
Variables
Data Types
Escaping Characters
Concatenation
Arithmetic Operators
Assignment Operators
Comparison Operators
Boolean Operators
Conditional Operator
If Statements
Else If Statements
If Else Statements
Switch Statements
While Loops
For Loops
Do While Loops
Break Statement
Continue Statement
prompt()
alert()
Date()
Event Handlers
String Object Methods
Math Object Methods
Window Object Methods
Arrays

HOW TO CREATE ARRAYS IN JAVASCRIPT

In javascript programming, an array is created by using the reserved javascript keyword new followed by the array constructor function which is written as Array().

So therefore, the following line will create an array named names:

var names= new Array();

Assigning values to an array are simply done as follows:

names[0]="John";
names[1]="Mary";

The numbers in between the square brackets are indexes. Array indexes, unless you specify otherwise when assigning them yourself, always start from 0 and not 1.

The array elements (like names[0] and names[1] above) can now be used as you would a regular variable.

You can also create a new array and assign values to it in one go as follows:

var names= new Array("John", "Mary");

Now Read:

How To Create An Array
How To Get Array Size
How To Loop Through An Array
How To Add Elements To An Array
How To Join Array Elements
How To Reverse Element Order In An Array
How To Slice Elements Of An Array Into Pieces
How To Sequentially Sort Elements In An Array

Home | Privacy Policy | Terms Of Use | Contact Us | Work At Home | Online Jobs | Smart Info | Online Jobs | Data Entry Jobs | Paid Surveys | Info | Info | Typing Jobs | Article Archive | Forum Posting Jobs