-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
48 lines (43 loc) · 1.04 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict'
const ask = require('./ask')
async function main() {
let choices
let answer
// Example 1 with default options
choices = [
'にほん',
'대한민국',
'Česká republika',
'España',
'Россия',
'România',
]
console.log(`Where do you come from? (${choices.length})`)
answer = await ask(choices)
console.log(choices[answer])
// Example 2 with all options specified
choices = [
'Abkhazia',
'Afghanistan',
'Aland Islands',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
'Antarctica',
'Antigua and Barbuda',
'Argentina',
'Armenia',
'Aruba',
'Ascension',
'Australia',
'Austria',
'Azerbaijan',
]
console.log(`Where do you come from? (${choices.length})`)
answer = await ask(choices, { color: 'HotPink', maxWindow: 6, pointer: '😀' })
console.log(choices[answer])
}
main()