javascript

Loop through object javascript

var items = {
    "item_1": "1",
    "item_2": "2",
    "item_3": "3"
}
for (var item in items) {
    console.log(items[item]);
}
Output
1
2
3

The code can be used to loop through an object which has some properties and its values. 

Example Demo

Was this helpful?