Web

JS遍历对象中的所有属性并获取属性值

2020-07-14  本文已影响0人  瑟闻风倾
{"cs_num2[2_2]":"","cs_num1[1_1]":"","cs_num0[1_1]":"","cs_num0[0_0]":"","cs_num2[0_0]":"","cs_num1[2_2]":"","cs_num2[1_1]":"","cs_num1[0_0]":"","cs_num0[2_2]":""}
commit:function(cs_num){
    var count = 0
    for (let item in cs_num) {//遍历属性
        if(cs_num[item] != ""){//获取属性值
            count += 1
        }
    }
    console.log("commitStorageInfo:" + count)
    if(count == 0){
        return
    }
}
上一篇下一篇

猜你喜欢

热点阅读