본문 바로가기

프론트엔드/jQuery

get an object properties in jQuery / javascript


var obj = {
    foo:    'bar',
    base:   'ball'
};

for(var key in obj) {
    alert('key: ' + key + '\n' + 'value: ' + obj[key]);
}


$.each(obj, function(key, value) {
    alert('key: ' + key + '\n' + 'value: ' + value);
});




d