/ Published in: JavaScript
This can be tested using the following piece of code
var a = [1, 2, 3, 4, 5];
alert(a.size());
var a = [1, 2, 3, 4, 5];
alert(a.size());
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if(typeof Array.prototype.size != 'function'){ Array.prototype.size = function(){ return this.length; } }