Monday 15 June 2015

javascript - JS how to call this function? -



javascript - JS how to call this function? -

how can phone call 'del' function? because name.del() , this.name no work :(

var name = function(){ this.del = function(){ } name.del(); // no work this.del(); // no work }

in order help you, must understand trying do. if solely want phone call function in anonymous one, this:

var name = function(){ function del(){ } del(); }

however, if utilize name in class-instance way, on right track.

function myclass(){ this.del = function(){ } } // instantiate var name = new myclass(); name.del();

there numerous additional ways to things. shoud go heavily depends on utilize case.

javascript

No comments:

Post a Comment