-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
104 lines (96 loc) · 2.4 KB
/
test.html
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
body {
height: 100vh;
margin: 0;
}
/* .container{
display: flex;
flex-direction: column;
height: 100%;
}
header{
height: 84px;
}
.content{
flex: 1;
}
.container{
height: 100vh;
}
header{
height: 84px;
}
.content{
height: calc(100vh - 84px);
} */
</style>
<body>
<div class="container">
<header>123</header>
<div class="content">444</div>
</div>
<script>
// function test(len, val) {
// let arr = [];
// for (let i = 0; i < len; i++) {
// arr.push(val);
// }
// return arr;
// }
// console.log(test(3, 4));
// console.log(new Array().setItem(1));
// let obj = { name: 1, val: 1 };
// console.log(new Object(10));
// console.log(Object.values());
// let arr = [2, 1, 3, 4];
// // console.log(arr.sort());
// function sortItem(arr) {
// if (arr.length < 2) {
// return arr;
// }
// // let pro = arr[parseInt(arr.length / 2)];
// const pro = arr.splice(Math.floor(arr.length / 2), 1)[0];
// let left = arr.filter(item => item < pro)||[];
// let right = arr.filter(item => item >= pro)||[];
// // if(left.length<1&&right.length<1){
// // return arr
// // }
// return sortItem(left).concat(pro,sortItem(right))
// }
// console.log(sortItem(arr));
// let tree = [{ name: 1, children: [{ name: 2 }] }, { name: 3 }];
// function test(arr) {
// let data = [];
// if(Array.isArray(arr)){
// arr.map(item => {
// data.push(item);
// if (item.children) {
// data = data.concat(test(item.children))
// delete item.children
// }
// });
// }
// return data
// }
// console.log(test(tree));
function test(){
return new Promise((resolve,reject)=>{
setTimeout(()=>{
console.log("呵呵")
},0)
resolve('哈哈')
})
}
test().then(res=>{
console.log(res)
})
</script>
</body>
</html>