Friday, 24 January 2020

Difference between accessing variable inside a function by passing as argument and global variable?

What is the difference of accessing variables inside the function by as argument and without argument?

var a = 1;
var b = 2;

function x() {
    var c = a + b;
    console.log(c)
}

function y(a, b) {
    var c = a + b;
    console.log(c)
}


from Difference between accessing variable inside a function by passing as argument and global variable?

No comments:

Post a Comment