📌  相关文章
📜  js 循环遍历对象 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:31.650000             🧑  作者: Mango

代码示例6
for (var key in validation_messages) {
    // skip loop if the property is from prototype
    if (!validation_messages.hasOwnProperty(key)) continue;

    var obj = validation_messages[key];
    for (var prop in obj) {
        // skip loop if the property is from prototype
        if (!obj.hasOwnProperty(prop)) continue;

        // your code
        alert(prop + " = " + obj[prop]);
    }
}