KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Javascript code: function doSomething(v1,v2){ //blah; } function SomeClass(callbackFunction,callbackFuncParameters(*Array*))={ this.callback = callbackFunction; this.method = function(){ this.callback(parameters[0],parameters[1]) // *.* } } var obj = new SomeClass( doSomething, Array('v1text','v2text') ); The problem is if I change function doSomething to function doSomething(v1,v2,v3){ //blah; } I have to change the corresponding line (marked as //*.* ) in SomeClass to this.callback(parameters[0],parameters[1],parameters[2]); What can be done to avoid the (*.*) line to be changed no matter how the number of 'doSomething' function's parameters is changed? Thanks a lot!
Tags (comma-separated)
Save Edits
Cancel