JS 对象遍历


var orgRoot = {
    271: {backgroundColor: '#f68f2b', textColor: '#FFFFFF'},
    272: {backgroundColor: '#49a9f3', textColor: '#FFFFFF'},
    273: {backgroundColor: '#78c06e', textColor: '#FFFFFF'},
    274: {backgroundColor: '#f68f2b', textColor: '#FFFFFF'},
    275: {backgroundColor: '#49a9f3', textColor: '#FFFFFF'}
};

var orgs = [];
for
( var p in orgRoot ){ if ( typeof ( orgRoot [ p ]) == " function " ){ } else { orgs.push(orgRoot [p]); } }
原文地址:https://www.cnblogs.com/cocoat/p/5869927.html