instance.js
来源:互联网 发布:seo认证 编辑:程序博客网 时间:2024/06/14 08:08
/**
*/
var a = {
b1 : {
c1 : [1, 2, 3, 4]//这是数组
},
b2 : "这是字符串"
};
console.log(JSON.stringify(a)); //log输出为{"b1":{"c1":[1,2,3,4]},"b2":"这是字符串"}
a.b3 = function () {
console.log("这是一个函数");
};
console.log(JSON.stringify(a)); //log输出仍然为{"b1":{"c1":[1,2,3,4]},"b2":"这是字符串"}
a.b3();
//a.b1.c2 = a;
//console.log(JSON.stringify(a)); //log输出"TypeError: Converting circular structure to JSON",提示有循环的结构是不能被字符串化的。
d=JSON.parse('{"b1":{"c1":[1,2,3,4]},"b2":"这是字符串"}');
console.log(d);
console.log(a==d);//log输出false
console.log(a.b1==d.b1);//log输出false
console.log(a.b2==d.b2);//log输出true
"D:\Program Files\JetBrains\WebStorm 8.0.6\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" instance.js
{"b1":{"c1":[1,2,3,4]},"b2":"这是字符串"}
{"b1":{"c1":[1,2,3,4]},"b2":"这是字符串"}
这是一个函数
{ b1: { c1: [ 1, 2, 3, 4 ] }, b2: '这是字符串' }
false
false
true
Process finished with exit code 0
- instance.js
- instance
- Instance Variable
- 关于instance
- gamebryo--Instance
- python instance
- sort instance
- stable_sort instance
- partial_sort instance
- typeinfo instance
- Python Instance
- Tomcat instance
- minifilter-----instance
- Oracle Instance
- DB2 - Instance
- instance()
- Vulkan Instance
- OOPS Corner : Instance Constructors
- 第十一周OJ(2)判断三角形
- 认识CoreData—使用进阶
- 阅读论文要点
- 解决安卓软键盘遮挡输入框
- 二分查找
- instance.js
- 微信公众号网页开发WeUI库说明(1)
- 基于OpenCV进行相机标定
- C#51课的主要内容
- socket编程入门
- REST
- 认识CoreData—初识CoreData
- Java8新日期时间API的20个使用示例
- explode字符串时候的结果