Kevin Powell - CommunityKP-C
Kevin Powell - Community3y ago
81 replies
Myndi

JS logic question

var x = 10;
var y = 20;

function abc(x, y) {
  x = x + 10;
  y = y + 10;
  console.log(x);
  console.log(y);
  return x * 10;
}

z = abc(x,y);
console.log(x);
console.log(y);
console.log(z);


Why is the answer to this 20 30 10 20 200 and not 10 20 20 30 200?
Would anyone mind explaining it to me?
Was this page helpful?