Skip to content

Commit d22738d

Browse files
committed
minor update in Tower of Hanoi ES6 code
1 parent fe5f225 commit d22738d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Others/Tower of Hanoi/es6/tower_of_hanoi.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/* Tower of Hanoi implementation in Javascript(ES6) */
22

33
// 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-
4+
const hanoi = (count, source, aux, destination, moves = []) => {
75
// When there is only single disk move it from 'source' to 'destination'
86
if (count === 1) {
97
moves.push({

0 commit comments

Comments
 (0)