Array.size function


/ Published in: JavaScript
Save to your folder(s)

This can be tested using the following piece of code

var a = [1, 2, 3, 4, 5];
alert(a.size());


Copy this code and paste it in your HTML
  1. if(typeof Array.prototype.size != 'function'){
  2. Array.prototype.size = function(){
  3. return this.length;
  4. }
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.