<!DOCTYPE html>
<html>
<body>
<p>Click the button below to loop through the properties of the object "person". </p>
<button onclick="myFunction()">click here</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x;
var txt="";
var person={fname:"Bill",lname:"Gates",age:56};
for (x in person)
{
txt=txt + person[x];
}
document.getElementById("demo").innerHTML=txt;
}
</script>
</body>
</html>