Answers for "How to loop thru an object and get key an dvalue"

2

loop over keys in object javascript

Object.keys(obj).forEach(function(key) {
  console.log(key, obj[key]);
});
Posted by: Guest on March-03-2020
1

loop key in object

const fruits = { apple: 28, orange: 17 }

for(key in fruits){
	console.log(key)
}
Posted by: Guest on June-29-2020

Code answers related to "How to loop thru an object and get key an dvalue"

Code answers related to "Javascript"

Browse Popular Code Answers by Language