博客
关于我
深拷贝和类型检测
阅读量:744 次
发布时间:2019-03-22

本文共 744 字,大约阅读时间需要 2 分钟。

 

//  深拷贝        var user1={name:"小明",age:18, deMent:{bumen:"市场部",no:"001"}}                  var  user2=JSON.stringify(user1);         var  user3=JSON.parse(user2);         user3.age=40;         user3.deMent.no="999";         console.log(user1); //{name: "小明", age: 18, deMent:{bumen: "市场部", no: "001"}}         console.log(user3) //{name: "小明", age: 40,deMent: {bumen: "市场部", no: "999"}}         // 深拷贝的步骤 JSON.stringify(被拷贝的对象); 把对象转为一个字符串         // JSON.parse(user2);会根据字符串生成一个新的对象         // 类型检测         /*         基本数据类型检测使用typeof来检测    console.log(变量 typeof 基本类型)         引用数据类型使用instanceof来检测    console.log(函数 instanceof Function)         */         // 检测数组         var arr=[1,2,3,4,,5];         console.log(Array.isArray(arr)); //true

 

转载地址:http://cmwwk.baihongyu.com/

你可能感兴趣的文章
Netty速成:基础+入门+中级+高级+源码架构+行业应用
查看>>
Netty遇到TCP发送缓冲区满了 写半包操作该如何处理
查看>>
netty(1):NIO 基础之三大组件和ByteBuffer
查看>>
Netty:ChannelPipeline和ChannelHandler为什么会鬼混在一起?
查看>>
Netty:原理架构解析
查看>>
Network Dissection:Quantifying Interpretability of Deep Visual Representations(深层视觉表征的量化解释)
查看>>
Network Sniffer and Connection Analyzer
查看>>
Network 灰鸽宝典【目录】
查看>>
Networkx写入Shape文件
查看>>
NetworkX系列教程(11)-graph和其他数据格式转换
查看>>
Networkx读取军械调查-ITN综合传输网络?/读取GML文件
查看>>
network小学习
查看>>
Netwox网络工具使用详解
查看>>
Net与Flex入门
查看>>
net包之IPConn
查看>>
net发布的dll方法和类显示注释信息(字段说明信息)[图解]
查看>>
Net操作Excel(终极方法NPOI)
查看>>
Net操作配置文件(Web.config|App.config)通用类
查看>>
Net连接mysql的公共Helper类MySqlHelper.cs带MySql.Data.dll下载
查看>>
NeurIPS(神经信息处理系统大会)-ChatGPT4o作答
查看>>