相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
for (var i = 0,l = res.length; i < l; i++) {
if (res[i].intIsDel === 1) {
res[i]['disabled'] = true res[i]['strName'] = res[i]['strName'] + ' ' + '(已删除)'
}
for (var j = 0; j < res[i].listThemeChildren.length; j++) {
if (res[i].listThemeChildren[j].intIsDel === 1) {
res[i].listThemeChildren[j]['disabled'] = true res[i].listThemeChildren[j]['strName'] = res[i].listThemeChildren[j]['strName'] + ' ' + '(已删除)'
}
for (var r = 0; r < res[i].listThemeChildren.length; r++) {
if (res[i].listThemeChildren[j].listThemeChildren[r].intIsDel === 1) {
res[i].listThemeChildren[j].listThemeChildren[r]['disabled'] = true res[i].listThemeChildren[j].listThemeChildren[r]['strName'] = res[i].listThemeChildren[j].listThemeChildren[r]['strName'] + ' ' + '(已删除)'
}
}
}
}
问题描述
感觉for循环太麻烦了,想简单一点,
这个怎么优化,递归吗,是递归的话怎么写
冉冉说
相关分类