Answers for "object key loop javascript"

53

javascript for each key in object

var person={
 	first_name:"johnny",
  	last_name: "johnson",
	phone:"703-3424-1111"
};
for (var property in person) {
  	console.log(property,":",person[property]);
}
Posted by: Guest on July-22-2019
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
0

iterate over object javascript

// For a functional one-liner
Object.keys(pokemons).forEach(console.log);
// Bulbasaur
// Charmander
// Squirtle
// Pikachu
Posted by: Guest on November-07-2020

Code answers related to "object key loop javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language