Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5438c1

Browse files
committed
add: object
1 parent 93cf68e commit f5438c1

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

01-Basics/09-object/app.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Name.Value collection
2+
let student = {
3+
name: 'Mike', // Property
4+
score: 100
5+
}
6+
7+
console.log(student.name);
8+
console.log(student.score);
9+
10+
student = {
11+
name: 'Mike', // Property
12+
score: {
13+
math: 100,
14+
art: 88,
15+
programming: 90
16+
},
17+
greet: function(){ // Method
18+
console.log('Welcome, ' + this.name + '!'); // this object
19+
}
20+
}
21+
22+
console.log(student.score.math); // 100
23+
student.score.math = 90;
24+
console.log(student.score.math); // 90
25+
26+
27+
student.greet();

01-Basics/09-object/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Learning JavaScript - Walker</title>
6+
<link rel="stylesheet" href="style.css">
7+
</head>
8+
<body>
9+
<h1>Object</h1>
10+
11+
<script src="app.js"></script>
12+
</body>
13+
</html>

01-Basics/09-object/style.css

Whitespace-only changes.

0 commit comments

Comments
 (0)