美文网首页
深浅拷贝的几种方法

深浅拷贝的几种方法

作者: _请输入昵称 | 来源:发表于2018-08-20 16:11 被阅读0次

    浅拷贝

    const  a1 = [1, 2]
    const a2 = a1.concat()
    const a2 = a1.slice()
    const [...a2] = a1
    const a2 = [...a1]
    const a2 = Object.assign({}, a1)
    

    相关文章

      网友评论

          本文标题:深浅拷贝的几种方法

          本文链接:https://www.haomeiwen.com/subject/cyeliftx.html