Function.prototype.getName = function(){ var s = this.toString(); var m = s.match(/function/s+([^(]+)/); return m[1]; }