-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
56 lines (43 loc) · 1.08 KB
/
test.js
File metadata and controls
56 lines (43 loc) · 1.08 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
56
let a = [1, 3, 5, 7]
const handler = async arr => {
await arr.map(async e => {
await console.log(e)
})
console.log('complete')
}
handler(a)
a = ['abc', 1]
a = a.join('=')
let sql = `select * from someTable where ${a};`
console.log(sql)
a = [[1, 2, 3], [4, 5], [6, 7, 8]]
const lowerHandler = async arr => {
const res = await arr.map(e => e + 5)
console.log('lowerRes', res)
return res
}
const upperHandler = async arr => {
const res = await arr.map(elem => lowerHandler(elem))
console.log('upperRes', res)
return res
}
// const promiseRemover = async (f, arg) => {
// const res = await f(arg)
// console.log(res)
// return Promise.all(res.map(async e => await e))
// // console.log(res2)
// // return res
// }
// promiseRemover(upperHandler, a).then(res => console.log(res))
// const f = async () => {
// const res = await upperHandler(a)
// return res[0]
// }
// f()
upperHandler(a).then(async res => {
console.log(res)
console.log(res[0])
await res[0].then(trueRes => {
console.log(trueRes[2])
})
})