-
Notifications
You must be signed in to change notification settings - Fork 0
/
2_alternativeQuestion.js
52 lines (44 loc) · 1.07 KB
/
2_alternativeQuestion.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
49
50
51
52
'use strict';
const Questioner = require('../lib/questioner/questioner');
(async () => {
const { alternativeQuestion } = new Questioner({
input: process.stdin,
output: process.stdout,
});
const result = {};
console.clear();
const profession = ['Cleaner', 'Gardener', 'Plumber', 'Dishwasher'];
result.profession = await alternativeQuestion(
'What is your profession?',
profession
);
const languages = {
Spanish: false,
English: false,
German: false,
JavaScript: true,
};
result.languages = await alternativeQuestion(
'Which languages do you know?',
languages
);
const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
result.number = await alternativeQuestion(
'What is your favorite number?',
numbers,
{ maxLength: 5 }
);
const colors = {
Green: false,
Red: true,
Blue: false,
White: true,
Black: false,
};
result.colors = await alternativeQuestion(
'What colors do you like?',
colors,
{ startWith: 2, isRounded: true }
);
console.log(result);
})();