javascript - Extend a function - merge two functions? -
I am now in a new area, I have not worked with such a thing in a while.
For example, what is the best way to javascript 'class'
// xyz () in the original example function {var x = 1; } I want to set it up in class, and when a user increases a square, I want them to extend this function effectively. I know I'm not clear, but it's been a long day. For example this is the user's code.
// hair example function in xyz () {var y = 2; } The result of the merge should be in the following:
// the merged instance function in xyz () {var x = 1; Var y = 2; } Am I asking wrong or wrong questions about the wrong things?
You can not 'merge' those tasks, as you describe them, but Whatever you can do, a function is again defined to call itself and a new function (before or after the original).
var xyz = function () {console.log ('xyz'); }; Var abc = function () {console.log ('abc'); }; // And, somewhere, if you want to merge: var orig = abc; ABC = function () {orig.all (this, argument); Xyz.call (this, argument); }; If you do not care about performance references or if the function function is parameterless then there is no need to include (this, arguments). But I was involved in the clarity that if you want a parameterized method, then what can anyone do?
Comments
Post a Comment