HLJ
发布于
2019-04-23 10:47:45
JSON.stringify()方法将JavaScript对象或值转换为JSON字符串
JSON.stringify()方法将JavaScript对象或值转换为JSON字符串
输出结果:[3,"false",false]
输出结果:{"x":[10,null,null,null]}
输出结果:"2006-01-02T07:04:05.000Z"
<script type="text/javascript"> console.log(JSON.stringify({ x: 5, y: 6 })); console.log(JSON.stringify([new Number(3), new String('false'), new Boolean(false)])); console.log(JSON.stringify({ x: [10, undefined, function(){}, Symbol('')] })); console.log(JSON.stringify(new Date(2006, 0, 2, 15, 4, 5))); </script>输出结果:{"x":5,"y":6}
输出结果:[3,"false",false]
输出结果:{"x":[10,null,null,null]}
输出结果:"2006-01-02T07:04:05.000Z"
最后生成于 2022-09-02 21:48:10