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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -