1 //对象 2 { 3 //简洁表示法 4 let o = 1; 5 let k = 2; 6 let es5 = { 7 o:o, 8 k:k 9 }; 10 let es6 = { 11 o, 12 k 13 }; 14 console.log(es5); 15 console.log(es6); 16 17 let es5_method={ 18 hello:function(){ 19 console.log('hello') 20 } 21 } 22 let es6_method={ 23 hello(){ 24 console.log('es6 hello') 25 } 26 } 27 es5_method.hello(); 28 es6_method.hello(); 29 30 } 31 { 32 //属性表达式 33 let a='b'; 34 let es5_obj={ 35 a:'c' 36 }; 37 let es6_obj={ 38 [a]:'c'//b:'c' 39 } 40 console.log(es5_obj) 41 console.log(es6_obj) 42 } 43 { 44 //新增API,Object.is就是=== 45 console.log('字符串',Object.is('abc','abc'),'abc'== 'abc') 46 console.log('数组',Object.is([],[]),[]==[]) 47 //Object.assign浅拷贝 48 console.log('拷贝',Object.assign({a:'a'},{b:'b'})) 49 // 50 let test ={k:123,o:456} 51 for(let [key,value] of Object.entries(test)){ 52 console.log([key,value]) 53 } 54 55 } 56 //基本不支持 57 { 58 //扩展预算符... 59 //let {a,b,...c}={a:'test',b:'kill',c:'ddd',d:'ccc'}; 60 61 }