How to Print Out All the property/propert value of Object in Javascript
First Define an Object with property and then use for /in loop with console to print out
Example:
Defining Object with property
Example:
Defining Object with property
Now print out property using for /in loop with consolevar fifa = { fullName: "
International Federation of Association Football", president: "
Sepp Blatter", motto: "
For the Game. For the World", formation: "
21 May 1904 " };
for (var property in fifa){
console.log(property);
}
Now print out property value using for /in loop with consolefor (var key in fifa){
console.log(fifa[key]);
}
Comments
Post a Comment