function hanoi(disc,src,aux,dst){
if(disc>0){
hanoi(disc-1,src,dst,aux);
console.log(`Move disc ${disc} from ${src} to ${dst}`);
}
}
hanoi(3,'SRC','AUX','DST');
function hanoi(disc,src,aux,dst){
console.log('step 1 :'+disc);
if(disc>0){
console.log('step 2 :'+disc);
hanoi(disc-1,src,dst,aux);
console.log('step 3 :'+disc);
console.log(`Move disc ${disc} from ${src} to ${dst}`);
console.log('step 4 :'+disc);
}
console.log('step 5 :'+disc);
}
hanoi(3,'SRC','AUX','DST');