How to clear the array in JavaScript?

Published on June 16, 2013 by Senthil Kumar

Filed under JavaScript

Last modified June 16, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 9939 times

There are times when you want to clear the array that you have already defined with entries and reuse it.

For example

Arry = [109,625,200];

How to clear the array in JavaScript?

One of the easiest way to clear the array contents in JavaScript is setting the Array Length t0 0.

Arry.length = 0;

Leave a Comment


You might be Interested in these Posts

How to Create an Empty array without defining the size in C# ?

When we create an array in C# , we tend to define the size of the array as shown below. String[] st...

How to use array Rank in C# ?

In C# , the Rank property of the array is is used to get the rank of the array. In simple terms , ra...

How to get the Number of Elements in an MultiDimensional Array in C# ?

In one of the previous articles , we demonstrated the usage of the Length property of the array in C...