deepCopy

9 天前(已编辑)

deepCopy

1.手写深克隆

function copy(data){
    let obj = data instanceof Array ? [] : {}
    for (const [k,v] of Object.entries(data)) {
        obj[k] = typeof v == "object" ? copy(v) : v;
    }
    return obj
}

使用社交账号登录

  • Loading...
  • Loading...
  • Loading...
  • Loading...
  • Loading...