-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbestme_fp.js
More file actions
55 lines (48 loc) · 1.5 KB
/
bestme_fp.js
File metadata and controls
55 lines (48 loc) · 1.5 KB
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
53
54
55
const daily_questions = {
pt : [
"\nO que aprendi hoje?",
"\nO que me deixou aborrecido? E o que eu poderia fazer para melhorar?",
"\nO que me deixou feliz hoje?",
"\nQuantas pessoas ajudei hoje?"
],
en : [
"\nWhat have I learned today?",
"\nDid anything upset me? What could I do about it?",
"\nWhat made me happy today?",
"\nHow many people have I helped today?"
]
}
const messages = {
start: "\nDigite PT para prosseguir em Português\nType EN to continue in English.\n",
welcome : {
en: "\n--> Welcome! Let's start!\n\n",
pt: "\n--> Bem-vindo! Vamos começar!\n\n"
},
finish: {
en: "\n --> Done! Let's review your answers.\n\n",
pt: "\n --> Pronto! Vamos rever suas respostas.\n\n"
}
}
const answers = []
const prompt = require('prompt-sync')();
run = (msgs, questions, results) => {
console.log(msgs.start)
lang = prompt(">> ") === "pt" ? "pt" : "en"
console.log(msgs.welcome[lang])
finish(msgs.finish[lang], ask(questions[lang], results), results)
}
ask = (questions, results) => {
questions.map((element) => {
console.log(element);
results.push(prompt(">> "))
})
return questions
}
finish = (finish_message, questions, results) => {
console.log(finish_message)
questions.map((element) => {
console.log(element)
console.log(">>>>> " + results[questions.indexOf(element)])
})
}
run(messages, daily_questions, answers)