Syntax

JavaScript Array Length Syntax

In JavaScript, array length: returns the number of items in an array or string — items.length

Quick Answer

Syntax
items.length
JavaScriptSyntax

Array Length

Code example
items.length

Returns the number of items in an array or string.

Learn More

How to array length in JavaScript

  1. Open your JavaScript file or editor.
  2. Copy the example, then replace its sample names and values for your code.

JavaScript Array Length Syntax

Use items.length.

Related Syntax References

Frequently asked questions

What is the JavaScript syntax for array length?

Use this pattern: items.length

Can I copy this JavaScript code example?

Yes. Use Copy code and adapt the example to your program.

Is this JavaScript syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify