iterate object javascript

JavaScript
var p = {
    "p1": "value1",
    "p2": "value2",
    "p3": "value3"
};

for (var key in p) {
    if (p.hasOwnProperty(key)) {
        console.log(key + " -> " + p[key]);
    }
}let obj = {
	key1: "value1",
	key2: "value2",
	key3: "value3",
	key4: "value4",
}
Object.entries(obj).forEach(([key, value]) => {
	console.log(key, value);
});Object.entries(obj).forEach(([key, value]) => {
	console.log(key, value);
});const object1 = {
  a: 'some string',
  b: 42
};

for (let [key, value] of Object.entries(object1)) {
  console.log(`${key}: ${value}`);
}

// expected output:
// "a: some string"
// "b: 42"
// order is not guaranteedfor (let item of items) {
    console.log(item); // Will display contents of the object inside the array
}var person={
 	first_name:"johnny",
  	last_name: "johnson",
	phone:"703-3424-1111"
};
for (var property in person) {
  	console.log(property,":",person[property]);
}
Source

Also in JavaScript: