Assigning function within function object without invoking the function itself.

Posted by webzide on Stack Overflow See other posts from Stack Overflow or by webzide
Published on 2010-05-21T16:24:08Z Indexed on 2010/05/21 17:00 UTC
Read the original article Hit count: 189

Filed under:
|

Dear experts,

I am trying to assign an function within an function object property without actually invoking then function itself.

for instance,

I have the following function object class definition

function objectOne(name, value, id){
    this.name=name;
    this.value=value;
    this.id=id;
    this.methodOne=methodFunction(this);
}

the last line this.methodOne=methodFunction(this); I want to pass the current object to the function but at the same time i don't want to execute the function right now.

But if I do it this way without the bracket this.methodOne=methodFunction then the argument of this object would not be passed as a parameter to the function.

Is there a way to work through this.

Thank you in advance

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about functions