forked from lfkdsk/PracticeCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethod.js
More file actions
66 lines (48 loc) · 848 Bytes
/
Copy pathmethod.js
File metadata and controls
66 lines (48 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
63
64
65
66
/**
* Created by liufengkai on 16/6/25.
*/
var age = 20;
if (age >= 18) {
console.log('adult');
} else {
console.log('child');
}
var x = 0;
for (var i = 0; i < 10000; i++) {
x += i;
}
console.log('x:' + x);
var lfk = {
name: 'lfkdsk',
index: 10
};
for (var key in lfk) {
console.log(key);
}
x = 0;
var n = 99;
while (n > 0) {
x += n;
n -= 2;
}
console.log("x: " + x);
var m = new Map([['sssss', 'ddd']]);
m.set('lfkdsk', 1111);
m.set('lfkddd', 9090);
// [].forEach.call(m, function (element) {
// console.log(element);
// });
m.forEach(function (value) {
console.log("value: " + value);
});
/**
* set 不支持重复
* */
var SetExp = new Set([1, 1, 2, 3]);
console.log(SetExp);
var a = [1, 2, 3];
/**
* 迭代器 for of
* for each
* for in(不建议会把另外的属性加入)
*/