How Can One Javascript Enclosure Internal Function Call Another Internal Function -


how can func2 call func1 within same javascript enclosure? possible?

var x = (function() {      return {         func1: function func1() {},         func2: function func2() {             var y = func1();  // doesn't work! does?         }     }  }()); 

define func1 before return, assign reference func1 property of return object.

var x = (function() {     function func1() {}      return {         func1: func1,         func2: function func2() {             var y = func1();         }     }  }()); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -