这里是 es6 的新手。有没有办法用 es6 特性缩短这段代码?我正在尝试从一个对象中解构并将这些拉出的属性放入一个新对象中。
const { Height, Width, Location, MapAttachmentTypes,
ZoomLevelAdjustment, CustomPushPins, CenterPushpinStyle, ScaleFactor } = args;
const body = {
Height,
Width,
Location,
MapAttachmentTypes,
ZoomLevelAdjustment,
CustomPushPins,
CenterPushpinStyle,
ScaleFactor
};
我试过这个,但没有奏效:
const body = { Height, Width, Location, MapAttachmentTypes, ZoomLevelAdjustment, CustomPushPins, CenterPushpinStyle, ScaleFactor } = args;