外觀
偏好使用 structuredClone 來建立深層複製。
structuredClone 是建立值深層複製的現代方法。
此規則的不正確程式碼範例
const clone = JSON.parse(JSON.stringify(foo)); const clone = _.cloneDeep(foo);
此規則的正確程式碼範例
const clone = structuredClone(foo);