O'Reilly logo

Essential JavaScript™ for Web Professionals, Second Edition by Dan Barrett

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

Core Objects

The core objects are objects that aren't associated with the JavaScript object hierarchy and are available to both client-side and server-side applications.

Array

Description: An array is an object that lets you store sets of data, with each element of the data set stored in its own unique position, which in turn can be referenced or retrieved.

Syntax for creating:

new Array(arrayLength) or

new Array(element0, element1, ..., elementN)

Parameters:

arrayLength— the desired initial length of the array

elementN— This is the initial set of values that will be stored in the array. The array length will be set to the number of arguments.

Implemented in: Navigator 3.0

Properties: index, input, length, prototype

Methods: concat, join, pop, ...

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