Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

count() in JavaScript (See related posts)

The same function as count() in php.

Array.prototype.count = function() {
	return this.length;
};


Sample :
var v_array = [ 5, 10, 15, 20, 25];
document.writeln(v_array.count());  // 5


Source: AB-D.fr

You need to create an account or log in to post comments to this site.


Click here to browse all 4852 code snippets

Related Posts