Answers for "javascipt iterate through object"

26

iterate object javascript

let obj = {
	key1: "value1",
	key2: "value2",
	key3: "value3",
	key4: "value4",
}
Object.entries(obj).forEach(([key, value]) => {
	console.log(key, value);
});
Posted by: Guest on May-02-2020
6

js loop through object

const obj = { a: 1, b: 2 };

Object.keys(obj).forEach(key => {
	console.log("key: ", key);
  	console.log("Value: ", obj[key]);
} );
Posted by: Guest on November-04-2020

Code answers related to "javascipt iterate through object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language