在学习深浅拷贝的时候在nodejs16版本下调用structuredClone()
方法报错
”structuredClone is not defined“
根据[Solved] structuredClone is not defined in JS and Node.js | bobbyhadz所说
As previously noted, the
structuredClone
method was introduced in Node.js version 17.0.0.If the output of the
node -v
command is less than17
, then you have to install the long-term supported version of Node.js.One way to install the LTS Node.js version is to use the official Node.js website.
structuredClone方法是在Node.js17引入的,所以最好的解决办法是升级到NodeJs17,node安装太麻烦了不搞了。
用浏览器吧。