JavaScript version of Towers of Hanoi