-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlooping.js
More file actions
62 lines (43 loc) · 848 Bytes
/
looping.js
File metadata and controls
62 lines (43 loc) · 848 Bytes
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
// const arr = [1, 2, 3, 4, 5, 6];
// const [,,...rest] = arr;
// console.log(rest);
// const [,,,,, c] = arr;
// console.log(a);
// console.log(b);
// console.log(c);
// 1 cr data
// for
// 1
// while
// do while
// 1
// foreach
// forin -> object
// forof -> iterators
// const arrList = [...Array(1000000).keys()]
// console.time("for")
// for (let i = 0; i < arrList.length; i++) {
// }
// console.timeEnd("for")
// console.time("while")
// let j = 0;
// while (j < arrList.length) {
// j++
// }
// console.timeEnd("while")
// console.time("dowhile")
// let k = 0;
// do {
// k++;
// } while (k < arrList.length);
// console.timeEnd("dowhile")
// console.time("forEach")
// arrList.forEach(element => {
// });
// console.timeEnd("forEach")
// 100
// > 1 && 100 < log(N)
// O(1)
// O(1) ->
// O(logN) ->
// O(N) ->