Crockford's hanoi function (from “The Good Parts”) [duplicate]
问题 This question already has answers here : How does recursive algorithm work for Towers of Hanoi? (2 answers) Closed 5 years ago . At the moment I'm reading Douglas Crockford's book, and the towers of hanoi function is a bit over my head. Even with logging stuff to the console I wasn't able to really understand what's going on. Here's the function with my additions: var hanoi = function (disc, src, aux, dst) { console.log(disc); console.log(src, dst); if (disc > 0) { hanoi(disc - 1, src, dst,