This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
如何进行一个深拷贝,是数组且去重。 | |
如:[1,2,3],[2,3,4,5] -> [1,4,5] | |
[1,2,3], {a:6, b:3} -> [1,2,3, a:6, b:3] | |
就是如何简单实现类jquery的$.extend(true, a, b)的效果。 | |
但与 | |
jQuery.extend(true,[1,2,3],[2,3]) // [2,3,3] | |
区别是题目要求得到是: 2,3,取其中不重复的。 | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 |