無法處理function啦還有RegExp啦,還有無法處理循環引用對象(這個我還沒有test)
就前兩點的話
var a={ a:1, b:new RegExp('test'), c:function(){} }
然后var b=JSON.parse(JSON.stringify(a))
輸出b的話
{ a: 1 b: {} }
就這樣啦
c:function都沒有復制過來,RegExp對象沒有處理
還有什么的話歡迎補充啦
------------------------------
我暈 好像我看stackoverflow上面這個弊端還蠻多的
you do not use Dates, functions, undefined, Infinity, RegExps, Maps, Sets, Blobs, FileLists, ImageDatas, sparse Arrays, Typed Arrays or other complex types within your object, a very simple one liner to deep clone an object is:
這么多都不能處理呢
