今天在学习时看到几段代码,让我感叹JS的灵活,特此一记: let stateObj = {a:1,b:3}; let newObj = {b:13,c:4} ; stateObj = {...stateObj, ...newObj} ; console.log(stateObj); // 输出 {a: 1, b: 13, c: 4} let {a = 0} = {a:1,b:3} ; a = a + 1 ; console.log(a) ; // 输出2 //ES6 允许直接写入变量和函数,作为…