Answers for "using for loop get value of an ogject in js"

85

javascript loop through object

Object.entries(obj).forEach(
    ([key, value]) => console.log(key, value)
);
Posted by: Guest on February-15-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 "using for loop get value of an ogject in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language