Javascript Source Code
/* Author: Hannes du Plooy */
/* Date: 20 Sep 2016 */
/* Objective: To solve the towers of hanoi with number of discs provided in the arguments to calling the program */
function hanoi(source,dest,other,discs) {
if (discs <= 0)
return;
hanoi(source,other,dest,discs-1);
console.log("Move from " + source + " to " + dest);
hanoi(other,dest,source,discs-1);
}
if (process.argv.length < 3) {
console.log("Please provide the number of disks!")
} else {
hanoi(0,2,1,parseInt(process.argv[2]),10);
}