Bespoke.js Starter Presentation

Topic Slide

Key Points

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]}`))

The End