字段和属性

结构体(记录)

//JavaScript 中没有结构体
let colorPoint = {
    x: 0, y: 0,
    color: "red"
};

//从 ES9(2018 年)起
let { color, ...point } = colorPoint;

console.log("color is", color);
console.log("point is", point);