[Javascript] JSON.parse, structuredClone, loadsh.cloneDeep

Both JSON.parse(JSON,strigify())& structuredClone doesn't work with Dateand function.

var foo = {name: 'foo', bar: () => 'bar'}
var foo2 = structuredClone(foo)
// caught DOMException: Failed to execute 'structuredClone' on 'Window': () => 'bar' could not be cloned.
 

 

Only lodash.cloneDeep is working as expected in any cases.

posted @   Zhentiw  阅读(39)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2021-04-18 [AWS] Lab: Lambda - build a Chaos monkey
2019-04-18 [Nginx] Configuration for SPA
2019-04-18 [Unit Testing] Using Mockito Annotations - @Mock, @InjectMocks, @RunWith
2019-04-18 [Functional Programming] Using Lens to update nested object
2018-04-18 [ES6] Proxy & Reflect
2018-04-18 [Angular] Service Worker Version Management
2018-04-18 [Angular] Upgrade existing Angular app to Progressive Web App
点击右上角即可分享
微信分享提示