我从以下
javascript对象中删除此(特定的“事件”)时遇到问题,这是来自jquery .each()循环.
weatherData:
{ "events":{ "Birthday":{ "type":"Annual","date":"20120523","weatherType":"clouds","high":"40","low":"30","speed":"15","direction":"0","humidity":"0" },"Move Out Day":{ "type":"One Time","date":"20120601","weatherType":"storm","high":"80","low":"76","direction":"56","humidity":"100" } },"dates":{ "default":{ "type":"clouds","20120521":{ "type":"clear","high":"60","low":"55","speed":"10","humidity":"25" } } }
这是.each()循环的缩小版本:
$.each(weatherData.events,function(i){ if(this.type == "One Time"){ delete weatherData.events[this]; } })
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。