function myFunction() { var x; var txt=""; varperson={fname:"Bill",lname:"Gates",age:56}; for (x in person) { txt=txt + person[x]; } document.getElementByIdx_x_x("demo").innerHTML=txt; }