Q:

javascript array assign to multiple variables

I got a bit logic problem. I want to assign array to several variables. But it doesn't work. Appreciate your help.
PS: variable values will be dynamic.
function Case(values){
  var A = [];
  var B = [];
  var C = [];
  if (temp === 0){
    A.push(values);
    temp+=1;
  } else if (temp === 1){
    B.push(values);
    temp+=1;
  } else if (temp === 2){
    C.push(values);
    temp = 0;
  }

  return [A,B,C];   
}

var temp = 0;
var values = [5, 4, 3, 6, 7 , 8];

Case(values);

if var values = [5, 4, 3, 6, 7 , 8];Output expected:
A = [5, 6];
B = [4, 7];
A = [3, 8];

if var values = [5, 4, 3, 6, 7 , 8, 10, 20, 30];Output expected:
A = [5, 6, 10];
B = [4, 7, 20];
A = [3, 8, 30];    

A:

function Case(values){
  console.log("values: " + values);
  var A = [];
  var B = [];
  var C = [];
  var i = 0;
  while(i < values.length) { 
    A.push(values[i++]);
    B.push(values[i++]);
    C.push(values[i++]);
  }
 
  console.log("A: " + A);
  console.log("B: " + B);
  console.log("C: " + C);
}

var values = [5, 4, 3, 6, 7 , 8];
Case(values);
values = [5, 4, 3, 6, 7 , 8, 10, 20, 30];
Case(values);

NOTE: values array should always have the number of elements in multiple of 3 because there are 3 arrays in this case A,B and C.

