Last active
December 9, 2018 11:07
-
-
Save ronit-mukherjee/c05ddc14538aefef8065e3f0b78b3648 to your computer and use it in GitHub Desktop.
Program for #RMJPQ5 on http://ronitmukherjee.com/practice-javascript-programs-for-interview/#RMJPQ5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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