JavaScript array.length | Find Length of an Array

The JavaScript length property is used to find the length of an array. For example:

HTML with JavaScript Code
<!DOCTYPE html>

   <p id="xyz"></p>

      const cities = ["Tokyo", "Bangkok", "Dubai", "Berlin", "Frankfurt"];
      document.getElementById("xyz").innerHTML = cities.length;

JavaScript length Syntax

The syntax of length property in JavaScript is:


The array refers to the array whose length we need to find.

Length of an array represents the total number of items or elements available in the array.

JavaScript Online Test

« Previous Tutorial Next Tutorial »

Follow/Like Us on Facebook

Subscribe Us on YouTube