We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe5f225 commit d22738dCopy full SHA for d22738d
Others/Tower of Hanoi/es6/tower_of_hanoi.js
@@ -1,9 +1,7 @@
1
/* Tower of Hanoi implementation in Javascript(ES6) */
2
3
// This function will recursively store all the moves and return the moves information as Array
4
-const hanoi = (count, source, aux, destination, moves) => {
5
- moves = moves || [];
6
-
+const hanoi = (count, source, aux, destination, moves = []) => {
7
// When there is only single disk move it from 'source' to 'destination'
8
if (count === 1) {
9
moves.push({
0 commit comments