Skip to content

Commit affed2d

Browse files
committed
Add code piece from the book JavaScript The Good Parts
1 parent 20373e2 commit affed2d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

JavaScript_The_Good_Parts.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// following JavaScript will run in a JS console, e.g. Firebug
2+
3+
var hanoi = function hanoi(disc, src, aux, dst) {
4+
if (disc > 0) {
5+
hanoi(disc - 1, src, dst, aux);
6+
console.log('Move disc ' + disc + ' from '
7+
+ src + ' to ' + dst);
8+
hanoi(disc - 1, aux, src, dst);
9+
}
10+
};
11+
12+
hanoi(3, 'Src', 'Aux', 'Dst');
13+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy