javascript add prototype method to all functions?
Posted
by salmane
on Stack Overflow
See other posts from Stack Overflow
or by salmane
Published on 2010-01-24T11:33:15Z
Indexed on
2010/04/18
7:03 UTC
Read the original article
Hit count: 276
JavaScript
Is there a way to add a method to all javascript functions without using the prototype library?
something along the lines of :
Function.prototype.methodName = function(){
return dowhateverto(this)
};
this is what i tried so far but it didnt work. Perhaps it is a bad idea also if so could you please tell me why?
if so can I add it to a set of functions i choose
something like :
MyFunctions.prototype.methodName = function(){
return dowhateverto(this)
};
where MyFunctions is an array of function names
thank you
© Stack Overflow or respective owner