Skip to content
Myr

Merge pull request #45 from raincole/hotfix/examples

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixed the choice example

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 2beb298, 10d4e35 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:examples/choice+4 added-4 removed
8 unmodified lines
9var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];1011console.log('Choose the coolest pet:');12program.choose(list, function(i){13 console.log('you chose %d "%s"', i, list[i]);13 console.log('you chose %d "%s"', i+1, list[i]);14 console.log();15 console.log('Choose the coolest pet, defaulting to loki:');16 program.choose(list, 2, function(i){17 console.log('you chose %d "%s"', i, list[i]);16 program.choose(list, 1, function(i){17 console.log('you chose %d "%s"', i+1, list[i]);18 process.stdin.destroy();19 });20});20});