we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
showing results for - "change variable inside function js"
Cristóbal
01 Sep 2016
1var a = 10;
2
3myFunction();
4
5function myFunction(){
6   a = 20;
7}
8
9alert("Value of 'a' outside the function " + a); //outputs 20
10