scope - write parent function var in javascript -


how change value of variable in parent function in javascript

for example:

function parent() {      var changeme = 0;       function child() {           changeme = 1;      } } 

thanks help!

the variable changeme within child() referring changeme in parent(). call child() , change it.

jsfiddle

function parent() {     var changeme = 0;      function child() {         changeme = 1;     }     child();      alert(changeme); } parent(); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -