Skip to content

Instantly share code, notes, and snippets.

@ronit-mukherjee
Last active December 9, 2018 11:07
Show Gist options
  • Save ronit-mukherjee/c05ddc14538aefef8065e3f0b78b3648 to your computer and use it in GitHub Desktop.
Save ronit-mukherjee/c05ddc14538aefef8065e3f0b78b3648 to your computer and use it in GitHub Desktop.
//https://jsfiddle.net/mukherjeeronit/5q2yz0pj/2/
var i = 10;
function main(a = 5) {
b = 0;
for (i = 1; i < a; i++) {
var b = b + i;
}
console.log("b inside function = ", b);
}
main();
console.log("i outside = " + i);
console.log("b outside function = " + b);
main(10);
console.log("i outside = " + i);
console.log("b outside function = " + b);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment