Javascript数组检查
javascript array check
我需要从另一个数组中检查一个数组的内容。
为例
var sData = {
'template': 'template',
'FOO': 'This is a paragraph'
};
如何检查该数组中template
键中是否包含'template'
值?
其实我需要的是这个
var sData2 = {
'template': 'template New',
'Boo': 'This is Not'
};
现在我需要检查sData2是否包含'template'
键,如果有,我需要用sData2数组'template'
值替换sData数组'template'
值。
for(key in sData2) {
if(typeof sData[key] !== 'undefined') {
sData[key] = sData2[key]
}
}
相关文章:
- 用于检查数组中是否存在元素的javascript自定义方法
- 如何检查数组中的对象是否等于选项值
- 循环以检查数组中的最后一个图像
- 检查数组中的变量
- 检查数组中是否存在字符串值,并返回找到的数组值js
- 检查数组是否包含
- 如何在jsrender中检查数组null或为空
- 如何检查数组中的剩余项
- 使用JQuery检查数组的索引中是否存在字符串
- 如何检查数组的元素在javascript中是否相同(超过2个元素)
- 检查数组中的项是否存在于对象内部
- Javascript应该使用什么方法来查找或检查数组中是否存在字符串
- 检查数组是否包含指定的对象
- 如何检查数组中的值?javascript
- javascript,jQuery-检查数组中是否存在值
- 检查数组中的元素
- 检查数组是否有空元素
- 检查数组中的部分匹配
- javascript indexOf 无法检查数组中的相同数字
- 如果字符串中存在错误,请检查数组中的char