15 1 0 4000 1 https://codeblock.co.za 300 true 0
theme-sticky-logo-alt

array.length

0 Comments

Programming Language

JavaScript [Version: ECMAScript (ECMA-262)]

Syntax

Typical Usage

Getting the number of items in an array in JavaScript.

Return Value(s)

Returns the array length as an integer.

Notes

You cannot assign values to arr.length. For example, arr.length = 9 has no effect.

Examples of array.length

Example 1

var cars = ['focus', 'fiesta', 'kuga', 'mustang'];;
console.log(cars.length);

The above will log 4 to the console because there are four items in the array.

Similar Functions in Other Languages

Was This Helpful?

Previous Post
array.join()
Next Post
str.trim()

0 Comments

Leave a Reply