Bubble Sort

0 1 2 3 4
var isSorted = false;
 
while (!isSorted) {
 
  isSorted = true;
 
  for (var i = 0; i < 4; i++) {
    var left = cards[i];
    var right = cards[i+1];
 
    if (right < left) {
      var copy = left;
      cards[i] = right;
      cards[i+1] = copy;
 
      isSorted = false;
    }
 
  }
 
}
Copy Area

What order should the cards be in?
You can choose Aces-high or Aces-low, so either:
A 2 3 4 5 6 7 8 9 10 J Q K
or
2 3 4 5 6 7 8 9 10 J Q K A

What if I made a mistake?
The program won't know. It doesn't check your work.
If you can correct your mistake, do so and carry on.
If you can't, just refresh the page and start again.