How to clear the array in JavaScript?

Published on June 16, 2013 by abundantcode

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 3179 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;
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


x

You might be Interested in these Posts

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...

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

You can use the Length property of the array to return the number of elements in it. Note that once ...