How to get the Length of an Array in JavaScript-Code Examples

Radu TM

How to get the Length of an Array in JavaScript

JavaScript by Radu TM June 21, 2022

const array = ['🍎', '🍌', '🍇', '🍈'];

// to get the length of an array in JavaScript, use the .length property:
console.log(array.length); // 4

0

17.903

How to get the Length of an Array in JavaScript

JavaScript by Radu TM June 21, 2022

// declare and initialize array
const array = [1, 2, 3, 4, 5];

console.log(array.length); // 5

0

17.903

How to get the Length of an Array in JavaScript

JavaScript by Radu TM June 21, 2022

const array = ['😃', '😄', '😁', '😆'];

// array.length will give us the number of items in the array
console.log(array.length); // 4

0

17.903

Related JavaScript Queries

Latest JavaScript Queries

Explore code examples by categories