get name in json object javascript for loop code example
Example 1: loop through json object javascript
var p = {
0: "value1",
"b": "value2",
key: "value3"
};
for (var key of Object.keys(p)) {
console.log(key + " -> " + p[key])
}
Example 2: loop though json object in javascript
var p = {
"p1": "value1",
"p2": "value2",
"p3": "value3"
};