var numberA = X;
var numberB = Y;
var numberC = Z;
var stock = null;

function change1 ={
  stock = numberA;
  numberA = numberB;
  numberB = stock;
}
function change2 ={
  stock = numberA;
  numberA = numberC;
  numberC = stock;
}

document.write(numberA+' '+numberB+' '+numberC);