function hanoi(n, source, target, spare) { if (n === 0) { return; } hanoi(n - 1, source, spare, target); console.log(`Move disk ${n} from ${source} to ${target}`); hanoi(n - 1, spare, target, source); } hanoi(3, "A", "C", "B");