Javascript call nested function -
Javascript call nested function -
i have next piece of code:
function initvalidation() { // irrelevant code here function validate(_block){ // code here } } is there way can phone call validate() function outside initvalidation() function? i've tried calling validate() think it's visible within parent function.
you can phone call validate within initvalidation. this.
function initvalidation() { // irrelevant code here function validate(_block){ // code here } homecoming validate(somevar); } validate not visible outside of initvalidation because of scope.
edit: here's suggestion of solution.
(function() { function validate(_block){ // code here } function initvalidation() { // irrelevant code here homecoming validate(somevar); } function otherfunctions() { // ... } // initvalidation = function }()); // initvalidation = undefined all of functions hidden outside function wrapper can see each other.
javascript nested-function
Comments
Post a Comment