Answers for "js loop through object0"

85

javascript loop through object

Object.entries(obj).forEach(
    ([key, value]) => console.log(key, value)
);
Posted by: Guest on February-15-2020
-1

js loop through object

const obj = { a: 1, b: 2, c: 3 }

for (const [key, value] of Object.entries(obj)) {
	console.log(key, value)
}
Posted by: Guest on January-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language