Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

JavaScript: Define array using Array constructor function

In my previous post, I explained how to create an Array using literal([]) notation. you can even define an array using Array constructor function.

var arr1 = new Array()
Above statement creates an empty array.

var arr2 =  new Array(10)
Above statement creates an array of size 10.

In addition to above, we can specify array by passing elements of array as arguments to constructor function.

var arr3 = new Array(1, 123.45, 5, 43);


Previous                                                 Next                                                 Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

JavaScript: Define array using Array constructor function

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×