-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTutorial15 Array.html
More file actions
22 lines (20 loc) · 859 Bytes
/
Tutorial15 Array.html
File metadata and controls
22 lines (20 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!doctype html>
<html>
<head>
<title>
Tutorial 1 JavaScript -- Hello World
</title>
</head>
<body>
<script type="text/javascript"> // Tag to include JavaScript in HTML.
var myArray1 = new Array(); // Creating a new array.
var myArray2 = [] ; // It is a shorthand version of above line. It will also create an array.
// While creating array you can add data in beginning or you can add later.
myArray1[0] = "Ashish";
myArray1[1] = "Bhatia";
var myArray3 = ["A","B","C"]; //This will create a new array and have 3 values in it.
var lengthofArray = myArray1.length // this will returns length of array.
document.write("Length of the array is : " + lengthofArray + "<br/>");
</script>
</body>
</html>