Skip to content

Commit 6a4f698

Browse files
committed
Update Exercise08.js
1 parent 9c523dc commit 6a4f698

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

Lesson07/Exercise08.js

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
11
// 1
2-
> const userInfo = ['John', 'chef', 34];
2+
const userInfo = ['John', 'chef', 34];
3+
34
// 2
4-
> function printUser(name, job, age) {
5-
... console.log(name + ' is working as ' + job + ' and is ' + age + ' years old');
6-
... }
5+
function printUser(name, job, age) {
6+
console.log(name + ' is working as ' + job + ' and is ' + age + ' years old');
7+
}
78

89
// 3
9-
> printUser(...userInfo)
10-
John is working as chef and is 34 years old
10+
printUser(...userInfo)
1111

1212
// 4
13-
> const detailedInfo = ['male', ...userInfo, 'July 5']
14-
=> [ 'male', 'John', 'chef', 34, 'July 5' ]
13+
const detailedInfo = ['male', ...userInfo, 'July 5']
14+
console.log(detailedInfo)
1515

1616
// 5
17-
> let detailedInfoCopy = [ ...detailedInfo ];
18-
=> undefined
19-
> detailedInfoCopy
20-
=> [ 'male', 'John', 'chef', 34, 'July 5' ]
17+
let detailedInfoCopy = [ ...detailedInfo ];
18+
console.log(detailedInfoCopy)
2119

2220
// 6
23-
> const userRequest = { name: 'username', type: 'update', data: 'newname'}
21+
const userRequest = { name: 'username', type: 'update', data: 'newname'}
2422

2523
//7
26-
> const newObj = { ...userRequest }
27-
=> undefined
28-
> newObj
29-
=> { name: 'username', type: 'update', data: 'newname' }
24+
const newObj = { ...userRequest }
25+
console.log(newObj)
3026

3127
//8
32-
> const detailedRequestObj = { data: new Date(), new: true, ...userRequest}
33-
=> undefined
34-
> detailedRequestObj
35-
=> { data: 'newname', new: true, name: 'username', type: 'update' }
28+
const detailedRequestObj = { data: new Date(), new: true, ...userRequest}
29+
console.log(detailedRequestObj)
3630

0 commit comments

Comments
 (0)