Skip to content

Commit 82b4b91

Browse files
committed
files renamed
1 parent 857a5db commit 82b4b91

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Lesson07/Exercise08.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// 1
2+
> const userInfo = ['John', 'chef', 34];
3+
// 2
4+
> function printUser(name, job, age) {
5+
... console.log(name + ' is working as ' + job + ' and is ' + age + ' years old');
6+
... }
7+
8+
// 3
9+
> printUser(...userInfo)
10+
John is working as chef and is 34 years old
11+
12+
// 4
13+
> const detailedInfo = ['male', ...userInfo, 'July 5']
14+
=> [ 'male', 'John', 'chef', 34, 'July 5' ]
15+
16+
// 5
17+
> let detailedInfoCopy = [ ...detailedInfo ];
18+
=> undefined
19+
> detailedInfoCopy
20+
=> [ 'male', 'John', 'chef', 34, 'July 5' ]
21+
22+
// 6
23+
> const userRequest = { name: 'username', type: 'update', data: 'newname'}
24+
25+
//7
26+
> const newObj = { ...userRequest }
27+
=> undefined
28+
> newObj
29+
=> { name: 'username', type: 'update', data: 'newname' }
30+
31+
//8
32+
> const detailedRequestObj = { data: new Date(), new: true, ...userRequest}
33+
=> undefined
34+
> detailedRequestObj
35+
=> { data: 'newname', new: true, name: 'username', type: 'update' }
36+

0 commit comments

Comments
 (0)