浅拷贝
const a1 = [1, 2]
const a2 = a1.concat()
const a2 = a1.slice()
const [...a2] = a1
const a2 = [...a1]
const a2 = Object.assign({}, a1)
浅拷贝
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
网友评论