Javascript Data Type How to - Loop through object like an array


We would like to know how to loop through object like an array.


<!DOCTYPE html>
<script type='text/javascript'
<script type='text/javascript'>
var myArray = { title: "my title", 
                description: "my description" 
              };<!-- w  w  w  . j  a  va2 s. com-->
var i = 0;
for(var i in myArray) {
   document.writeln('The '+ i + ' is ' + myArray[i]);


The code above is rendered as follows: