-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (39 loc) · 900 Bytes
/
index.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
#!/usr/bin/env node
import inquirer from "inquirer";
let TODO = [];
let check = true;
while (check) {
const answer = await inquirer.prompt([
{
type: "input",
name: "todo",
message: "Enter The name of your task : "
},
{
type: "confirm",
name: "more",
message: "Add more toDo's : ",
default: false
}
]);
const ans = answer;
check = ans.more;
if (ans.todo) {
TODO.push(ans.todo);
}
else {
console.log("Please Do valid entry");
}
}
if (TODO.length > 0) {
let count = 1;
console.log("Your ToDo's are :");
TODO.forEach(td => {
console.log("\t" + count + "). " + td);
count++;
});
}
else {
console.log("\n No Work ToDo (kick-back n Relax)");
}
//console.log(answer)