Javascript default object method -
this question has answer here:
is there way how create default method call when method called object undefined?
e.g.
myobj = { default: function(){ console.log("you've called method isn't defined"); }, sayhi: function(){ console.log("myobj says hi!"); } } //console output: "myobj says hi!" myobj.sayhi(); //console output: "you've called method isn't defined" myobj.methodthatisnotreallythere();
Comments
Post a Comment