Bespoke.js Starter Presentation
Topic Slide
Key Points
- First point
- Second point
- Final point
Syntax Highlighting
Powered by Lea Verou's Prism
function hanoi (n, a, b, c) {
return n ? hanoi(n - 1, a, c, b)
.concat([[a, b]])
.concat(hanoi(n - 1, c, b, a)) : []
}
console.log(hanoi(3, 'left', 'right', 'mid')
.map((d) => `${d[0]} -> ${d[1]}`))