-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoldcall.js
executable file
·83 lines (74 loc) · 1.57 KB
/
coldcall.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env node
const students7_1 = [
'Alex',
'Alvi',
'Angelina',
'Candy',
'Cassidy',
'Cristobal',
'Damien',
'Daniel',
'David',
'Du Min',
'Esay',
'Fezz',
'Geormary',
'Grace',
'Hady',
'Imran',
'Ivan',
'Jamee',
'James',
'Jarrett',
'Jasleen',
'Jenna',
'Jessica',
'Jordan',
'Kathy',
'Kelvin',
'Hafiz',
'Nora',
'Quisa',
'Ray F.',
'Ray U.',
'Rob',
'Sarah',
'Talia',
'Teyanna',
'Theodore',
'Tiffany',
'Yesenia'
]
let section = process.argv[2]
switch(section) {
case '7.1': printStudent(students7_1); break;
default: console.log('Specify section!')
}
function printStudent(names) {
let count = 0
const id = setInterval(function(){
process.stdout.clearLine()
process.stdout.cursorTo(0)
switch (count%4) {
case 0:
process.stdout.write("/-\\|/-\\|/-\\|/-\\|");
break;
case 1:
process.stdout.write('-\\|/-\\|/-\\|/-\\|/');
break;
case 2:
process.stdout.write("\\|/-\\|/-\\|/-\\|/-");
break;
case 3:
process.stdout.write('|/-\\|/-\\|/-\\|/-\\');
break;
}
count += 1
}, 100)
setTimeout(function() {
process.stdout.clearLine()
process.stdout.cursorTo(0)
clearInterval(id)
console.log(`The winner is: 🎉 ${names[Math.floor(names.length * Math.random())]} 🎉`)
}, 1600)
}