I've been learning OOP and playing around in JavaScript, and was wondering how to get something that looks like this to work...
function myApp(){
this.nav = function(){
function toggle(state = 'show'){
//toggle nav code...
}
toggle();
}
}
var app = new myApp();
app.nav();
How would go about accessing the toggle function from here like this...
app.nav().toggle('hide');
return {toggle : function() {...}}to be chainable