-
Notifications
You must be signed in to change notification settings - Fork 0
/
training.js
executable file
·65 lines (54 loc) · 1.11 KB
/
training.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
const list = {
value: 1,
next: {
value: 2,
next: {
value:3
}
}
}
//while loop
const printList = (listArg) => {
let list = listArg
while (list) {
console.log(list.value)
list = list.next
}
}
//recursion
const printListRec = (list) => {
console.log(list.value)
list.next && printListRec(list.next)
}
//revert recursin
const printListRecReverse = (list) => {
list.next && printListRec(list.next)
console.log(list.value)
}
// printListRec(list)
// printList(list)
//printListRecReverse(list)
const jwt = require('jsonwebtoken')
const token = jwt.sign({username: 'test', password: 'test'}, 'secret')
console.log(token)
const userData = jwt.decode(token)
console.log(userData)
// const promiseResolver = (arg, done) => {
// let a
// Promise.resolve(arg).then(ar =>{
// a = ar
// console.log(a)})
// while(!a){
// console.log('wait')
// setTimeout(() => {
// done()
// }, 1123)
// }
// if(a){
// console.log('in return')
// return a
// }
// }
// const x = promiseResolver(1, () => {})
// console.log(x)
// 86400000 мс - один день