var x1 ='&spades',
y1 ='&clubs'
z1 ='&hearts';
var x2 = ' ', y2 = ' ', z2 = ' ';
var x3 = ' ', y3 = ' ', z3 = ' ';
var Array = [x1,y1,z1,
x2,y2,z2,
x3,y3,z3];
Then I get an input from the user asking them to select a location (ex. x1) store it as input 1, then ask them for another location (ex. x2) and store that as input 2, and I have to swap the locations of the value.
I initially tried something like Array[input1] = Array[input2]
But Array[input1] is undefined even though input1 = x1 because Array[x1] is still undefined.
So how do I make Array[x1] = Array[0] so I can swap the values or is there an easier way?
Sorry if my question is poorly formed.