Hello Friends 👋,

Welcome To Infinitbility! ❤️

To get the array length in typescript, just use Array.length it will count and return the numbers of the element. You have just like ArrayVariable.length;


In TypeScript, creating an array has some different syntax because typescript supports static typing.

i.e when we create an array we have first what we will store in the array-like string, number, object, etc.

Today, we will learn how to create an array and how to check array length in typescript.

Let’s start with the creation

Now, we are going to create an array of objects then we have to provide Array<object> before storing data in variables like the below example.

To check the length of the array we have the .length option to know the length of the array.

To find the length of exampleArr we have to write exampleArr.length and it will return 3.

interface domain {
  id: number,
  name: string

let exampleArr: Array<domain> = [
  { id: 1, name: 'infinitbility' },
  { id: 2, name: 'notebility' },
  { id: 2, name: 'repairbility' },



typescript, array, length, example
TypeScript, get length of array example.

I hope it helps you, All the best 👍.