192
rated 0 times
[
195]
[
3]
/ answers: 1 / hits: 39061
/ 16 Years ago, sat, february 21, 2009, 12:00:00
I'm trying to extend the Array.push
method so that using push will trigger a callback method and then perform the normal array function.
I'm not quite sure how to do this, but here's some code I've been playing with unsuccessfully.
arr = [];
arr.push = function(data){
//callback method goes here
this = Array.push(data);
return this.length;
}
arr.push('test');
More From » arrays