创建从现有对象继承的新对象时 JavaScript 问题上的三个点

Three dots on JavaScript problem while creating new objects that inherit from a existing one

假设我有

const adrian = {
    fullName: 'Adrian Oprea',
    occupation: 'Software developer',
    age: 31,
    website: 'https://oprea.rocks'
};

const bill = {
    ...adrian,
    fullName: 'Bill Gates',
    website: 'https://microsoft.com'
};

console.log(bill.fullName)

我在一个网站 (https://oprearocks.medium.com/what-do-the-three-dots-mean-in-javascript-bc5749439c9a) 上读到 ...adrian, 会赋予对象 billadrian 相同的属性。但是当我尝试执行代码时,出现了这个错误:

    ...adrian,
    ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

我是否遗漏了一些东西来完成这项工作?

问题出在我在 VSCode 中使用的节点版本上,基本上我只需要从 v6.11.2(很久以前,哈哈)更新到 v14.17.3,再次感谢@charlietfl