![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
json数组
柠檬花开_
跳坑笔记
展开
-
JSO字符串和Object相互转换
object 转化成 JSON字符串htmlStyleJson = JSON.stringify(this.htmlStyle);JSON字符串转换成Object1、this.htmlStyle = eval('(' + jumpData.htmlStyle + ')') ;2、this.htmlStyle = JSON.parse(jumpData.htmlStyle);原创 2021-01-13 11:06:00 · 235 阅读 · 0 评论 -
判断对象数组中的对象是否具有指定的元素(是否存在某个属性),如果有就将元素值赋值为空或者删掉,没有就不做修改
1.使用in关键字。该方法可以判断对象的自有属性和继承来的属性是否存在。var o={x:1};"x" in o; //true,自有属性存在"y" in o; //false"toString" in o; //true,是一个继承属性2.使用对象的hasOwnProperty()方法。该方法只能判断自有属性是否存在,对...原创 2019-04-12 10:52:39 · 4933 阅读 · 0 评论