Create Array in javascript

Check out Best Alternative to InfoPath


Here in this article, we will discuss Creating Arrays in javascript. Also, you can check out some posts on:


– Lock users who provide bad passwords in Asp.Net

– ASP.NET provider model tutorial

– Different Methods in SqlRoleProvider class in Asp.Net

JavaScript supports a more complicated data type known as an array. An array is a collection of individual values grouped together. An array essentially contains a series of numbered containers into which you can place values. Each container can contain a string, a number, or any other data type.

To create a new array, you create a new instance of the Array object:

var arrayName = new Array(number of elements);

The number of elements is just the initial number of elements in the array; you can add more on the fly as you work with the array, but it is a good idea to initialize the array with the likely number of elements you will use.

  1. Open a new HTML document in your preferred HTML or text editor.
  1. Create the head of the document with opening and closing head

tags:

<head>

 

</head>

  1. Insert a script block in the head of the document:

<head>

<script language=”JavaScript”>

<!–

// –>

</script>

    </head>

  1. Create a variable named myArray and initialize it as a new array with five elements:

<body>

<script language=”JavaScript”>

<!–

var myArray = new Array(5);

// –>

</script>


</body>

  1. Save the file and close it.

You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →