-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathobject-demo.js
More file actions
60 lines (47 loc) · 859 Bytes
/
object-demo.js
File metadata and controls
60 lines (47 loc) · 859 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
const id = 10;
const title = 'hello';
const myObj = {
id,
title,
greet() {
return 'hello';
}
}
function test (obj) {
let id = 0;
let title = '';
({id, title} = obj);
console.log(id + ' ' + title);
}
test({
id: 30,
title: 'hello'
});
const post = {
id: 10,
title: 'hello',
content: 'aaa',
picUrl: 'http://....',
likes: 50,
tags: ['', '', '', ''],
comments: [
{
replyId: 101,
author: {
firstName: 'soongon',
lastName: 'kim'
},
content: 'hello',
date: '2020..'
},
{
replyId: 101,
author: 'kim',
content: 'hello',
date: '2020..'
},
{}
]
}
const myArr = [1,2,3];
let [a, b, c, d=0] = myArr;