Skip to content

Commit b59f2e1

Browse files
author
Siyuan Gao
authored
Create exercise_04.js
1 parent 1417c6e commit b59f2e1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Lesson07/exercise_04.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// 1
2+
let singers = [];
3+
// 2
4+
singers.push({ name: 'miku', age: 16 });
5+
// 3
6+
singers[0].name = 'Hatsune Miku'
7+
console.log(singers);
8+
// 4
9+
singers[0].birthday = 'August 31';
10+
console.log(singers);
11+
// 5
12+
console.log(singers[0].name);
13+
const propertyName = 'name';
14+
console.log(singers[0][propertyName]);
15+
// 6
16+
let myConsole = { name: 'PS4', color: 'black', price: 499, library: []};
17+
// 7
18+
console.log(Object.keys(myConsole));
19+
// 8
20+
if (myConsole.ramSize) {
21+
console.log('ram size is defined.');
22+
}

0 commit comments

Comments
 (0)