-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproperty1.js
57 lines (49 loc) · 959 Bytes
/
property1.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
/**
* 2017-9-16 Shi Ruitao
*/
var o = Object.create(null,{
foo:{
enumerable: true,
writable: true,
configurable: true,
value: 'hello'
}
});
var a = Object.defineProperty(o,'n', {
enumerable: true,
configurable: true,
writable: true,
value: 2
});
o.n = 1;
console.log(a, o);
var b = Object.defineProperty(o, 'foo', {
enumerable: true,
writable: true,
configurable: true,
value: null
});
var arr = [1,2];
Object.defineProperty(arr, '3', {
enumerable: true,
writable: true,
configurable: true,
value: 3
});
console.log(arr);
var arrs = ['a', 'b'];
Object.defineProperty(arrs, '4', {
enumerable: true,
writable: true,
configurable: true,
value: 128
});
console.log(arrs);
var arrss = [1,2];
Object.defineProperty(arrss, 'length', {
enumerable: true,
writable: true,
configurable: true,
value: 1
});
console.log(arrss);