对象实例的匹配
·
Yin灏
var person01 = { name: 'Jimmy', age: 20, gender: 'male' };
var person02 = { name: 'Erica', age: 40, gender: 'female' };
var person03 = { name: 'Frankie', age: 30, gender: 'male' };
var person04 = { name: 'Alexander', age: 28, gender: 'male' };
var { name, age, gender } = person01;
console.log(name, age, gender); // Jimmy 20 male
// () 有用,不能去掉
({ name, age, gender } = person02);
console.log(name, age, gender); // Erica 40 female
console.log('');
var { name: value01, age: value02, gender: value03 } = person03;
console.log(value01, value02, value03); // Frankie 30 male
var { name, ...others } = person04;
console.log(name, others); // Alexander {age: 28, gender: "male"}