Javascript default object method -


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

Popular posts from this blog

c# - ItextSharp font color issue in ver 5.5.4+ -

jquery - Multiple issues with pushstate: history, loading, calling functions -

ios - retrievePeripherals deprecated in IOS7 how to substitude it with retrievePeripheralsWithIdentifiers -