Consider following code:
 function A(param) { var m = param; m = m + 10; return m + param; } function B(param) { var n = param; n = 20; return param + n; }
console.log(A(10),B(10));
 
What will be printed to the console?
Explanation
Consider answer:

function A(param) { 
    var m = param;   // m=10
    m = m + 10;   // m= 20 (10+10)
    return m + param;   // return 30 (20+10)
}

function B(param) {
    var n = param;   // n=10
    n = 20;   // n = 20;
    return param + n;   //return 30 (10+20)
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback