let messages = {
1: {
id: '1',
text: 'Hello World',
userId: '1',
},
2: {
id: '2',
text: 'By World',
userId: '2',
},
};
// what does this statement do?
const {
[1]: message,
...otherMessages
} = messages;
console.log("other messages: ", otherMessages);
我们没有一个名为otherMessages的变量,那么剩余语法怎样在这个变量上工作?总体上,上述语句是做什么的,它有些复杂?
otherMessages
中其余的属性。 - VLAZ