File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
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 ( ) ;
Original file line number Diff line number Diff line change
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 >
You can’t perform that action at this time.
0 commit comments