O'Reilly logo

Web Technology: Theory and Practice by M. Srinivasan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.9 ARRAYS

Array is one of the non-primitive data types in JavaScript. Regular arrays, associated by an index, start with an index of 0. Associative arrays are indexed by Strings. Since JavaScript is a loosely typed language, the elements of an array need not belong to the same type. Thus, there can be a mix and match of numbers, arrays, objects, etc within an Array.

   var arr = new Array();
   var arr2 = [‘a’, ‘b’];

4.9.1 Array Implementation Basics

There is no need to define a dimension for the Array as is commonly the requirement in other languages like C or C#. The way Arrays are implemented internally is that the elements are behaving as in a hash table. This means they are stored as name-value pairs. This type of implementation makes the job ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required