File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+ < script src ="index.js "> </ script >
8+ </ head >
9+ < body >
10+ </ body >
11+ </ html >
Original file line number Diff line number Diff line change 1+ info = {
2+ 'name' : 'joy' ,
3+ 'age' : 12 ,
4+ 'city' : 'Beijing'
5+ }
6+
7+ console . log ( info . city )
8+ console . log ( info [ 'age' ] )
9+
10+ for ( let key in info ) {
11+ console . log ( key + ' ' + info [ key ] ) ;
12+ }
13+
14+ class Person {
15+
16+ intro ( ) {
17+
18+ console . log ( 'welcome to js...' )
19+ }
20+
21+ }
22+
23+ person = new Person ( ) ;
24+ person . intro ( ) ;
25+
26+
27+ const calculator = {
28+ add : function ( a , b ) {
29+ return a + b ;
30+ } ,
31+ subtract : function ( a , b ) {
32+ return a - b ;
33+ }
34+ } ;
35+
36+ console . log ( calculator . add ( 5 , 3 ) ) ; // 8
37+ console . log ( calculator . subtract ( 8 , 2 ) ) ; // 6
38+
39+
You can’t perform that action at this time.
0 commit comments