Skip to content

输出什么?

Posted on:2021年7月3日 at 22:31
const myFunc = ({ x, y, z }) => {
  console.log(x, y, z);
};

myFunc(1, 2, 3);

myFunc 期望接收一个包含 x, yz 属性的对象作为它的参数。因为我们仅仅传递三个单独的数字值 (1, 2, 3) 而不是一个含有 x, yz 属性的对象 ({x: 1, y: 2, z: 3}), x, yz 有着各自的默认值 undefined.

原文转自:https://fe.ecool.fun/topic/c8a6250a-c30b-4ddc-8b5c-5313c04e136e