.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

JavaScript Array Clear

Posted By:Syed Shakeer Hussain       Posted Date: September 17, 2009    Points: 10    Category: Javascript    URL: http://www.dotnetspark.com  
 

Clear() method is used to clear all the defined array. In this section, you will study how to clear the Array in JavaScript. You can see in the given example, we have create an instance of array which consists of elements 'Hello' and 'World'. Then we have used the clear() method which removes all elements from an Array instance. After removing the array by clear() method, the resulting array's length will become zero.



Array Clear Example



[After using the clear() method, the array is removed.]


Output will be displayed as:

Array Clear Example

Array is:

Heloo

World

Now the Array is:

[After using the clear() method, the array is removed.]

 


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend