JavaScript Tutorial

Array In JavaScript
Previous Home Next

An array is a variable that can store many variables.JavaScript has variables and properties associated with array Creating an array is slightly different from creating a normal variable.

The Array parameter is also used in list of strings or integers.

Syntax :

var vehicls = new Array( "car", "bike", "train" );

 

Example :

<html>
<head>
<script>
var myArray = new Array();

myArray[0] = "Football"; 
myArray[1] = "Baseball";
myArray[2] = "Cricket";

document.write(myArray[0]+"</br>" + myArray[1]+"</br>" + myArray[2]);
</script>
</html>
</head>

Output :

Football
Baseball
Cricket
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: